[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: GREP -v in a loop
From: |
Paul Jarc |
Subject: |
Re: GREP -v in a loop |
Date: |
Tue, 14 Jan 2003 17:06:51 -0500 |
User-agent: |
Gnus/5.090011 (Oort Gnus v0.11) Emacs/21.2 (i686-pc-linux-gnu) |
"Andrew Barton" <address@hidden> wrote:
> outname=$i
> grep -v Time $i | grep -v DATE | grep -v Location | grep -v Units |
> grep -v Depth > $outname
Don't write to your input file. The file is truncated around the same
time that the first grep opens and reads from it, so there's no
guarantee that it will see anything at all. Write to a temporary
file.
outname="$i.out"
rm -f "$outname"
grep -v Time "$i" ... > "$outname"
mv -f "$outname" "$i"
paul