cat and grep without destroying file
- From: "(``-_-´´) -- Fernando" <ubuntu@xxxxxxxxxxxxx>
- Date: Fri, 28 Sep 2007 14:22:13 +0100
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
Attachment:
signature.asc
Description: This is a digitally signed message part.
ubuntu-users mailing list
ubuntu-users@xxxxxxxxxxxxxxxx
Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/ubuntu-users
- Follow-Ups:
- Re: cat and grep without destroying file
- From: Gerald Dachs
- Re: cat and grep without destroying file
- From: Mihamina (R12y) Rakotomandimby
- Re: cat and grep without destroying file
- From: Chris Malton
- Re: cat and grep without destroying file
- Prev by Date: ubuntu text mode
- Next by Date: Re: ubuntu text mode
- Previous by thread: ubuntu text mode
- Next by thread: Re: cat and grep without destroying file
- Index(es):
Relevant Pages
|