Helpful Information
 
 
Category: Scripts
find and remove

Hi,

Want to cycle through each single in a directory, remove all lines not containing |, write the ouput in a new and overwrite the old file with the new one.

I have this code:



files=`find . -print | sort`
for myfile in $files; do
grep '|' $myfile > $OutFILE
mv -f $OutFILE $myfile
done


but I am getting the following problems:

1.) Displays the content of the file --> I don't want that
2.) does nothing else


Could someone please give an idea?

Cheers,
monaL

LOL This question is crossposted: linux forum and here.

Look at the linux forum, just posted your answer there.










privacy (GDPR)