2

Is it possible to search and print only the matched pattern from grep. The default action is to print the whole line.

1 Answer 1

3

Yes. Use the -o option, e.g.,

$ echo 'hello wide world' | grep -o wide
wide

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .