cat and grep without destroying file

(=?utf-8?q?=60=60-=5F-=C2=B4=C2=B4?=) -- Fernando ubuntu at
Fri Sep 28 13:22:13 UTC 2007

I've been trying to make a small shell script that would remove a line from a text file.
But every time that I pipe the content of grep to the original file, the file ends up blank.
So, I've made the script use a copy and them replace the original.
It looks like this:
#for i in $(/bin/ls -1); do cat $i | egrep -v ^Date > $; mv $ $i; done

Isn't there any other way, without using the mv?

BUGabundo  :o)
Linux user #443786    GPG key 1024D/A1784EBB
My new micro-blog @
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part.
URL: <>

More information about the ubuntu-users mailing list