Alexander 'Loki' Agibalov wrote:
>
> Hello,
>
<snip>
> As I understand, I should use 3 commands:
> 1. find to get the list of files
> 2. cat to display the contents of them
> 3. grep to find the string
>
> but I cant even make the first two working together!
> Can you please tell me how to do that?
>
<snip>
$ find directory_to_search -type f | xargs grep 'search_pattern'
This will print the filename (-type f tells find to only print regular
files and no directories od other special devices it may find) along
with the matched line (assuming you want to know that). Then you can go
one step further and issue
$ find directory_to_search -type f | xargs grep 'search_string' \
| cut -d':' -f1 | sort | uniq
to get a sorted file list with duplicates removed.
Marc
--
Marc Mutz <[EMAIL PROTECTED]> http://marc.mutz.com/Encryption-HOWTO/
University of Bielefeld, Dep. of Mathematics / Dep. of Physics
PGP-keyID's: 0xd46ce9ab (RSA), 0x7ae55b9e (DSS/DH)
-
To unsubscribe from this list: send the line "unsubscribe linux-newbie" in
the body of a message to [EMAIL PROTECTED]
Please read the FAQ at http://www.linux-learn.org/faqs