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?
Linux user #443786 GPG key 1024D/A1784EBB
My new micro-blog @ http://BUGabundo.net
-------------- next part --------------
A non-text attachment was scrubbed...
Size: 189 bytes
Desc: This is a digitally signed message part.
More information about the ubuntu-users