[NBLUG/talk] Searching for an expression within all files
Todd Cary
todd at aristesoftware.com
Mon Jan 17 10:56:56 PST 2005
Ross -
I came across this command and I am not sure of the diferences:
# grep -r interbase.so /etc/*
Todd
Ross Thomas wrote:
>On Fri, 14 Jan 2005 16:42:19 -0800, "Todd Cary"
><todd at aristesoftware.com> said:
>
>
>>I want to seach for the expression within all files contained within
>>/etc.
>>
>>find /etc -type -f
>>
>>That will give me all files.
>>
>>fgrep "interbase.so" [files]
>>
>>Will search within files, but I do not know how to feed the output of
>>"find" into "fgrep".
>>
>>
>
>xargs is your friend, thusly:
> find /etc/ -type f | xargs grep "interbase.so"
>
>Also, if you are on Linux or using the gnu versions of find & xargs,
>use the '0' options (that's a zero) so that files with strange chars
>in their names work. Like this:
> find /etc -type f -print0 | xargs -0 grep "interbase.so"
>
>HTH.
>
>Ross.
>
>_______________________________________________
>talk mailing list
>talk at nblug.org
>http://nblug.org/cgi-bin/mailman/listinfo/talk
>
>
>
>
--
More information about the talk
mailing list