Search And Highlight With Grep

14th July 2008 - 1 minute read time

Searching for things in many files is easy with the grep command, but in order to view the results with the expression results highlighted you need to use grep in conjunction with less.

grep expression *.txt | less +/expression

If you wanted to search all files called something.txt for the letter d you would use this line.

grep d *.txt | less +/d


nicer option would be - alias grep='grep --color=auto'

hdaz (Fri, 12/12/2014 - 11:18)

Add new comment

The content of this field is kept private and will not be shown publicly.