Mark Pearl

Search for text in all files in sub-directories

Search all files for matching text - show positions in files…

grep -r "TextToSearch" .

Search all files for matching text - show just the file name with the match…

grep -rl "StuffToSearch" .

Or…

grep -rl "StuffToSearch" .
grep -rli "StuffToSearch" *
grep -l 'Search Statement' . | while read f; do mv "$f" targetDir; done

References

Drew’s grep tutorial



blog comments powered by Disqus

Want to get my personal insights on what I learn as I learn it? Subscribe now!


/