with egrep also iam getting both the lines
 
cn: PUN/PROJ/RAJENDRA TEKADE
mail: [email protected]
--
cn: PUN/PROJ/KIRAN PANDHE
mail: [email protected]
--

but i like to get only mail entry as result 
not both cn & mail enty

--- On Wed, 17/12/08, Nadeem M. Khan <[email protected]> wrote:

From: Nadeem M. Khan <[email protected]>
Subject: Re: [LinuxVadaPav] advanced search script required
To: [email protected]
Date: Wednesday, 17 December, 2008, 6:56 PM






On Wed, Dec 17, 2008 at 4:37 PM, Ashwin Muni <ashwin.muni@ gmail.com> wrote:
> On Wed, Dec 17, 2008 at 5:36 PM, ashok abraham <ashok...@yahoo. com> wrote:
>
>> i have my entire organisation adress book details stored in ldap format
>> in a text file in the following manner

> You Can use the below command
>
> "grep stringtosearch (In your case mail:) filename"
>
> "grep mail: filename"
>
> --
> Ashwin R.

Guys, he wants to grep by region.

Ashwin, don't know what version of egrep you have, but you can give this a try:

egrep -AN PUN filename

Where N=Number of lines you want to display after the match is found.

You could also write a small perl script to do this, but that would be
an overkill.

Regards,
NMK.
 














      Add more friends to your messenger and enjoy! Go to 
http://messenger.yahoo.com/invite/

[Non-text portions of this message have been removed]

Reply via email to