cat and grep without destroying file

(=?utf-8?q?=60=60-=5F-=C2=B4=C2=B4?=) -- Fernando ubuntu at bugabundo.net
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 > $i.new; mv $i.new $i; done

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

-- 
BUGabundo  :o)
(``-_-´´)	http://Ubuntu.BUGabundo.net
Linux user #443786    GPG key 1024D/A1784EBB
My new micro-blog @ http://BUGabundo.net
-------------- 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: <https://lists.ubuntu.com/archives/ubuntu-users/attachments/20070928/1aabab01/attachment.pgp>


More information about the ubuntu-users mailing list