PDA

View Full Version : [ubuntu] search for string and to end of file



viddect
August 3rd, 2012, 10:15 PM
i am looking for a way to search for a string, in this case a date and then grab everything till the EOF and do some 2nd search for a specific string. I am working with conman and powerman logs.

any ideas would be helpful.

papibe
August 3rd, 2012, 10:18 PM
Hi viddect.

Take a look at the command 'grep'. It is very easy to use:

grep pattern file
Another alternative would be 'awk'.

Let us know how it goes.
Regards.

steeldriver
August 3rd, 2012, 10:27 PM
or even sed


sed '/pattern/,$!d' fileit really all depends what you want to do with the matched text