Re: grep question
From: Sunder Iyengar (Sunder.Iyengar_at_VERITAS.COM)
Date: 03/25/05
- Previous message: Frank Chiavoni: "Re: how to stop subdirectory search when using find command in aix"
- Maybe in reply to: John Dunn: "grep question"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Fri, 25 Mar 2005 10:29:30 +1100 To: aix-l@Princeton.EDU
John,
If the string to be searched is "abc" in the following file (listing
below), as per your stated rules (ignore string in the first 8
characters), then the grep would be as follows.
# cat sample
abc1552uenkd
776wabc288e8e
12345678abc2663
7831687138abcjdoiewd
abdabc3791u312ew1jeo
dgsaiudadgagdagabc
1234567abc366dj
# grep '^.........*abc' sample
12345678abc2663
7831687138abcjdoiewd
dgsaiudadgagdagabc
Hope this helps.
Explanation -
^=beginning of line
.=any character
After a string of 8 . (dots), the ninth . followed by * says zero or
more characters.
Sunder.
-----Original Message-----
From: IBM AIX Discussion List [mailto:aix-l@Princeton.EDU] On Behalf Of
John Dunn
Sent: Friday, 25 March 2005 2:42 AM
To: aix-l@Princeton.EDU
Subject: grep question
I want to search for a lines matching a string in a file, but ignore
the first 8 characters in each line in the search. However I do not want
to remove the first 8 characters from the file.
Can I do this with grep?
John
- Previous message: Frank Chiavoni: "Re: how to stop subdirectory search when using find command in aix"
- Maybe in reply to: John Dunn: "grep question"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|
|