//View Tip #743
» Get your machines IP adress
» Get real names of current users
» Command examples from shell-fu
» List non-system users
name
Similar Tips
» Print a random shell-fu tip» Get your machines IP adress
» Get real names of current users
» Command examples from shell-fu
» List non-system users
Latest tips by RSS
Click here to subscribe
Follow Shell-Fu on Twitter
Click here to follow
Follow Shell-Fu on identi.ca
Click here to follow
I've often seen people using the find command on a directory to get all the files, then using these with grep to find files containing a particular word. This can however, be done better just using grep:
greps for occurances of 'search_for' in the specified directory and below, or the current directory if none specified.
Options:
-i case insensitive
-n shows line number
-H shows file name
-R recursive
grep --color=auto -inHR "search_for" /in/dir
greps for occurances of 'search_for' in the specified directory and below, or the current directory if none specified.
Options:
-i case insensitive
-n shows line number
-H shows file name
-R recursive
Comments
Add your comment
#1
grep word /dir/*
Posted 2009-05-01 09:00:05

