mgferg
asked on
printing portion of a line after a pattern match
Hi, I have a number of lines which I need to extract only the portion of the line after a pattern match is found
e.g.
2010-08-16 11:34:57,869 text: text: ....text ID: rest of line
so I want to only show "rest of line" based on it finding a match for "ID:"
(note there coud be a different number of ":" preceeding the pattern to match "ID:")
This is to be used in a Solaris 10 shell script and probably using something like awk, but can't find out how to do this
Thanks
Mark
e.g.
2010-08-16 11:34:57,869 text: text: ....text ID: rest of line
so I want to only show "rest of line" based on it finding a match for "ID:"
(note there coud be a different number of ":" preceeding the pattern to match "ID:")
This is to be used in a Solaris 10 shell script and probably using something like awk, but can't find out how to do this
Thanks
Mark
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
-R seems to be an invalid option
and note I don't want the full line - I'm using grep to get that already - I only want portion of the line "after" a "pattern match"
and note I don't want the full line - I'm using grep to get that already - I only want portion of the line "after" a "pattern match"
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
The syntax is:
grep [options] PATTERN [FILE...]
or
grep [options] [-e PATTERN | -f FILE] [FILE...]
So in you case:
grep -R ID *
this will search for ID in all files. If you want to find out more just read the grep man file.