Grep is a tool with which every programmer should be familiar. It is easy to use to grep to search a text file for lines matching a particular pattern, but sometimes it useful to search a text file for multiple patterns. You can accomplish this by switching over to the egrep command. For example,
egrep 'my|example|search' myfile.txt
will search myfile.txt for all lines which contain either the string "my", "example", or "search".
No comments:
Post a Comment