On Fri, Oct 20, 2000 at 12:41:15PM -0700, Erik Steffl wrote: > Damian Menscher wrote: > > On Fri, 20 Oct 2000, Erik Steffl wrote: > > > the main difference is a sideeffect, sort of, if grep is called for > > > with one file as an argument it only prints the line matched, not the > > > filename, so you get bunch of lines (each successfull match) but you > > > have no idea which files these lines are in... > > > > > > and probably some other more or less dirty tricks... > > > > Look in the grep manpage for the -l option ;) > > but then you get only the filename, not the line(s) matched, I have > found out that I usually prefer (find most usable) the way grep works > when it has more then one file (filename:line), so I use that as a > default (of course, if only one file is found by find you still don't > see filename in grep's output even when using xargs:-)
This is because that grep will only print the file name for multiple files. You can fool grep by including /dev/null, as in: $ find / -type f | xargs grep blah /dev/null So if only one file is found by find, grep will still think it's searching multiple files & preface the file name(s). thks.jeff