Pantek Library
Hosting Provided By
CybrHost
High Speed Hosting

cat and grep without destroying file

From: ``-_-´´) -- Fernando <ubuntu(at)bugabundo.net>
Date: Fri Sep 28 2007 - 09:22:13 EDT


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

-- ubuntu-users mailing list ubuntu-users@lists.ubuntu.com Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/ubuntu-users

Received on Sun Sep 30 10:18:48 2007

This archive was generated by hypermail 2.1.8 : Sun Oct 21 2007 - 01:03:07 EDT


Contact Us  Legal Notices  Order Services Online 
Pantek Home  Privacy Policy  IT news  Site Map  Pantek Library