Better to do cat tmp >"$line" since this won't alter file permissions and so forth, which replacing might.
You're forgetting to delete your tmp file.
You also don't need to store the files in the temporary file list.txt, you can pipe them straight into the while loop:
Code:
# CREATE A BACKUP! You're overwriting your originals, what if something went wrong?
tar -cf ~/sed-backup.tar ./
ls | while read line
do
sed "/#Text_to_be_deleted/d" "$line" >tmp
cat tmp>"$line"
done
rm -f tmp
Last edited by Corona688; 11-16-2011 at 02:32 PM..
I moved my server while it was running. I was in a hurry. Also it's a bare motherboard with drives in a cage sitting basically on their own.
Once I realized how badly I had hurt it doing this, I mounted the board in a tower case I repurposed, mounted the drives, power supply etc. Now the... (1 Reply)
Hi,
I am running a script sample.sh in bash environment .In the script i am using sed and awk commands which when executed individually from terminal they are getting executed normally but when i give these sed and awk commands in the script it is giving the below errors :-
./sample.sh: line... (12 Replies)
I feel that i am missing something obvious but i can't find what is wrong.
I have a script that is launching some functions with "&" and each call is feeding the array with a value. When all calls are finished I just want to retrieve the values of that array.
It is looking like that :
... (5 Replies)
Hello all,
I am fed up on trying to install my newly purchased usb wireless antenna to my fedora14 machine; so I seek help of all you linux masterminds out there. It worked well in my Win XP. Please help me in setting up it to my Fedora. .
Details follows:
The device model is : Aztech... (5 Replies)
hi!
i need to do a ksh script that uses a wile loop that is fed form below
while read line
do
some things
done < myfile
inside the while loop i need to read user input to ask the user what he wants to do, but "read" reads the file, and not the standard input
while read line
do
... (2 Replies)
I am fed up of getting viruses on my computer.
They come from other computers on the network and I'm fed up with them.
Can anyone reccomend some virus scanning software or something that I can use to prevent my machine from getting viruses?
Thanks (3 Replies)