[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: getting 'grepped' files from file list
From: |
Dave B |
Subject: |
Re: getting 'grepped' files from file list |
Date: |
Tue, 16 Jun 2009 11:54:12 +0200 |
User-agent: |
Thunderbird 2.0.0.21 (X11/20090527) |
Bob Proulx wrote:
> Dave B wrote:
>> Edward Peschko wrote:
>>> 1: suppose I want to build a 'project' file, which contains a list of
>>> files that I care about - one that avoids temporary files, binary
>>> files, etc. This would then be a very nice feature.
>> You can use xargs to obtain pretty much the same effect.
>>
>> xargs grep pattern < filelist.txt
>>
>> (with the usual issues to consider when using xargs)
>
> You can avoid using xargs here if you don't want to use it.
>
> grep PATTERN $(<filelist.txt)
Yes that's true. I just felt that xargs (well, GNU xargs to be honest) gives
you a bit more control in case the filelist contains filenames with spaces,
wildcards or other oddities, which will cause problems with the
$(<filelist.txt) approach, since the shell does word splitting and pathname
expansion on the result of that.
Instead,
xargs -d '\n' grep pattern < filelist.txt
should take care of most of the issues. It does require GNU xargs however,
as I said.
--
D.