re: About grep

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



> My personal favorite is still:
>
>    find . -type f -exec grep 'abc' {} /dev/null \;
>
> Note the use of /dev/null as a second file name arg to grep:
> this forces grep to emit the name of the file the search string was
> found in, if any...without it you get a list of the matched lines, but
> no file name where found...useless.

A handy varient to find the file in which the pattern was found is

find . -type f -exec grep -l 'abc' {} \;

Rgds

rus
-- 
e: support@xxxxxxxxxxx
t: 1-888-327-6330
www.jvds.com - Root on your own box
www.vpscolo.com - Your next hosting company


-- 
redhat-list mailing list
unsubscribe mailto:redhat-list-request@xxxxxxxxxx?subject=unsubscribe
https://www.redhat.com/mailman/listinfo/redhat-list

[Index of Archives]     [CentOS]     [Kernel Development]     [PAM]     [Fedora Users]     [Red Hat Development]     [Big List of Linux Books]     [Linux Admin]     [Gimp]     [Asterisk PBX]     [Yosemite News]     [Red Hat Crash Utility]


  Powered by Linux