The problem seems to be very easy to google for but many options for grep I was able to find didn't work for me. So if you want to get a list of file names containing some specific string in SunOS or Solaris you can use this command:
find . -type f | xargs grep -l "<string to search>"
use this if you want to ignore access/file read errors:
find . -type f 2>/dev/null | xargs grep -l "<string to search>" 2>/dev/null
find . -type f | xargs grep -l "<string to search>"
use this if you want to ignore access/file read errors:
find . -type f 2>/dev/null | xargs grep -l "<string to search>" 2>/dev/null
Yeah, recently I learned about xargs command. Very useful :)
ReplyDelete