Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

I'm using grep to do this, like:

grep someText file.log

But this returns the complete line in results. If someText is found in the middle of a line I don't want to ouput the whole line, just the part after and including the someText. Is there a way to achieve this?

share|improve this question
add comment

1 Answer 1

up vote 6 down vote accepted

Append a .* to your search and use the -o (--only-matching) option:

grep 'someText.*' -o file.log
share|improve this answer
    
Thanks a lot... –  Daud Ahmad May 12 '11 at 6:37
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.