[NTLUG:Discuss] scratching head
Fred James
fredjame at concentric.net
Thu Feb 27 18:51:54 CST 2003
Carl Haddick wrote:
>OK, I'll bite.
>
>The signature with the pipelined commands - shooting from the hip, I
>would say this finds 'normal files', characterizes them with 'file',
>takes the text types and cuts the file name out of the 'file' command's
>output, and then greps them for "...".
>
>In other words, type all lines in all text files that contain at least
>three arbitrary characters, skipping lines that are 0, 1, or 2
>characters in length.
>
>Did I get it right? Do I win anything?
>
>:-)
>
>Carl
>
>
>
>>--
>>find . -type f | xargs file | grep -i text | cut -f1 -d: | xargs grep "..."
>>
>>
>>
>>_______________________________________________
>>https://ntlug.org/mailman/listinfo/discuss
>>
>>
>>
>
>
>
Very close - the "..." in this case just means any string of characters
that you want to search for, though I admit that isn't standard
notation. For example:
find . -type f | xargs file | grep -i text | cut -f1 -d: | xargs grep
"hello"
would look for the string hello in each text file found in the path
beginning at . (dot) - as a side note, experience has shown me that on
certain system you may want to include something like "grep -v proc"
(this seems to be system dependent), especially if you start at / in
your search, to avoid getting hung up in some endless mess. Maybe
someone could shed some light on that?
--
find . -type f | xargs file | grep -i text | cut -f1 -d: | xargs grep "..."
More information about the Discuss
mailing list