Re: Command line assistance needed



On 2006-07-17, Øyvind Røtvold wrote:
"Chris F.A. Johnson" <cfajohnson@xxxxxxxxx> writes:

On 2006-07-16, ~David~ wrote:
[ snip ]

cat filenames* | grep string-here

UUOC (useless use of cat).

No it isn't, filenames* may be more than one file, in which case cat
will conCATenate them, as it is supposed to.

You can use multiple filenames as arguments to grep; cat is NOT
necessary. The only use cat would have is to prevent grep from
showing filenames, and you don't need cat for that (grep -h).
(Not to mention that the OP *wanted* the filenames.)

--
Chris F.A. Johnson, author | <http://cfaj.freeshell.org>
Shell Scripting Recipes: | My code in this post, if any,
A Problem-Solution Approach | is released under the
2005, Apress | GNU General Public Licence
.



Relevant Pages

  • Re: Cat and input redirection tricks?
    ... by using shell utilities, but i just dont know how:) ... These filenames exist in the same directory as filelist.txt, ... i know about cat *.xyz> ...
    (comp.unix.shell)
  • Re: Cat and input redirection tricks?
    ... by using shell utilities, but i just dont know how:) ... These filenames exist in the same directory as filelist.txt, ... filenames (cat filelist.txt:) but how do i connect these two into ... cat $> bigfile ...
    (comp.unix.shell)
  • Re: Cat and input redirection tricks?
    ... merge all this filenames into one big file. ... i know about cat *.xyz> bigFile ...
    (comp.unix.shell)
  • Re: script copy files based upon content
    ... > I am trying to figure out how to come up with a shell script that will cat ... > or grep a file and if it contains the word SPAM it will then move it to ... > don't know what to put in for * since the filenames are always changing. ...
    (Debian-User)
  • Re: Command line assistance needed
    ... UUOC (useless use of cat). ... No it isn't, filenames* may be more than one file, in which case cat ... will conCATenate them, ...
    (alt.os.linux)