Re: Help with grep
From: Alan Connor (xxxxxx_at_xxxx.xxx)
Date: 08/29/03
- Previous message: Troll: "Re: Variables - redirecting output"
- In reply to: David: "Help with grep"
- Next in thread: rakesh sharma: "Re: Help with grep"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Fri, 29 Aug 2003 03:53:08 GMT
On 28 Aug 2003 18:10:16 -0700, David <davidol@hushmail.com> wrote:
>
>
> Hi there,
>
> I want to recursively search directories for scripts that don't use
> our environment file foo_env.sh -- if the script uses foo_env.sh, it's
> sourced once in the file.
>
> This command doesn't give me what I want, it instead returns any
> scripts that don't refer to foo_env.sh on every line!
>
> find . | xargs grep -v 'foo_env.sh' | cut -f1 -d: | uniq
>
> Could someone suggest a command that will work...
>
> Thanks,
>
> David
This should, David:
#!/bin/sh
for file in `find . -type f` ; do
if ! grep 'string' $file &> /dev/null ; then
echo "$file" >> ~/listfile
else continue
fi
done
$EDITOR ~/listfile
exit 0
Alan C
-- take control of your mailbox ----- elrav1 ----- http://tinyurl.com/l55a
- Previous message: Troll: "Re: Variables - redirecting output"
- In reply to: David: "Help with grep"
- Next in thread: rakesh sharma: "Re: Help with grep"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|