Re: cat and grep without destroying file
- From: Chris Malton <chrism@xxxxxxxxxxxxxxxxxxx>
- Date: Sun, 30 Sep 2007 15:27:15 +0100
(``-_-´´) -- Fernando wrote:
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?
I don't think so, some how. I have never successfully done it without
an mv or a cp.
Chris
--
ubuntu-users mailing list
ubuntu-users@xxxxxxxxxxxxxxxx
Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/ubuntu-users
- References:
- cat and grep without destroying file
- From: (``-_-´´) -- Fernando
- cat and grep without destroying file
- Prev by Date: Re: ubuntu text mode
- Next by Date: Gutsy un-hibernate plus ctrl+alt+bksp = reboot ?
- Previous by thread: cat and grep without destroying file
- Next by thread: Re: cat and grep without destroying file
- Index(es):
Relevant Pages
|