Reputation: 4662
I use below command to search for a specific text in a directory and its sub-directories.
find . -exec grep -i -n -w 'search text' /dev/null {} \;
Result is displayed in below format
./directory/filename:<line_number>:<matching text>
I want to exclude all lines with /*
from the result.
How to do this?
OS Version: Sun OS 5.10
Upvotes: 0
Views: 121
Reputation: 56935
You could pipe the result through grep
again, filtering out matches of /*
:
find . -exec grep -i -n -w 'search text' /dev/null {} \; | grep -v '/\*'
where grep -v
returns lines that don't match (and I'm assuming you mean a literal /*
hence the regex).
Upvotes: 3