Finding a String

How to find a string somewhere on the system?

Many times we are called to search for a string, but we have no idea where it may be lurking. Judicious use of the find and grep commands will make you a hero with your co-workers.

# find . -type f -exec grep "string or options" /dev/null {} \;

Normally using only:
# find . -type f -exec grep "string/options" {} \;

Produces the target string, but you will have no clue as to where it is located, making this almost as frustrating as using windoze! Remember when grep'ing against multiple files the filename will be listed before the match.

$ grep there *
foo:I found the target here
bar:You are there

Have a Unix Problem
Do you have a UNIX Question?

Unix Books :-
UNIX Programming, Certification, System Administration, Performance Tuning Reference Books

Return to : - Unix System Administration Hints and Tips

(c) www.gotothings.com All material on this site is Copyright.
Every effort is made to ensure the content integrity.  Information used on this site is at your own risk.
All product names are trademarks of their respective companies.
The site www.gotothings.com is in no way affiliated with or endorsed by any company listed at this site.
Any unauthorised copying or mirroring is prohibited.