Yes, the example below would've worked... I think my problem was missing
double quotes screwing up the parsing of spaces. I actually don't have a
reason not to do it the simple way, however; it's just that I don't know
much about grep/bash. I think I'm going to use grep -lr, as it is giving
the
Martin Kelly wrote:
> I have just written a shell script that greps a directory for a certain
> pattern and reports each file that contains the pattern along with the
> filename before it (this is why I wrote it... if I just do a "ls | cat |
> grep pattern" or something like that it will report
mp;sloppy response.
Happy New Year to allHorst
> Date: Sun, 31 Dec 2006 13:33:03 -0800
> From: Martin Kelly <[EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]>>
> Reply-To: Eugene Unix and Gnu/Linux User Group <
euglug@euglug.org <m
for the quick&sloppy response.
Happy New Year to allHorst
> Date: Sun, 31 Dec 2006 13:33:03 -0800
> From: Martin Kelly <[EMAIL PROTECTED]>
> Reply-To: Eugene Unix and Gnu/Linux User Group
> To: Eugene GNU/Linux Users Group
> Subject: [Eug-lug] Strang
ate: Sun, 31 Dec 2006 13:33:03 -0800
From: Martin Kelly <[EMAIL PROTECTED]>
Reply-To: Eugene Unix and Gnu/Linux User Group
To: Eugene GNU/Linux Users Group
Subject: [Eug-lug] Strange shell behavior
I have just written a shell script that greps a directory for a certain
pattern and reports e
None of the filenames in the example I used have spaces though.
However, I think you helped me find a bug that will appear later. cat
$file is now cat "$file" so it will interpret spaces literally.
Still having the problem. Anyone else have ideas?
Ben Barrett wrote:
If any of the filenames (o
If any of the filenames (or cmdline input) have spaces, you'll need to be
careful to handle that correctly...
you might want to incorporate xargs, but I am forgetting a specific hint for
this scenario
which is tucked away too deeply, sorry.
Ben
On 12/31/06, Martin Kelly <[EMAIL PROTECTED]> w
I have just written a shell script that greps a directory for a certain
pattern and reports each file that contains the pattern along with the
filename before it (this is why I wrote it... if I just do a "ls | cat |
grep pattern" or something like that it will report the text that
matches but n