How can I remove ^@ (Windows EOF character) from the end of text files
Hi,
I generated a couple of thousand xml files which contain site maps. These files were generated in Windows and therefore have a special character at the end of the file to indicate the end of the file. When I upload these to Linux I get an ^@ character on the last line of the file which generates an error message when the xml sitemap file is read. So I need to remove this special character. I can edit each file manually with vi and remove the character but it will take me forever.
Is there a way to remove this character from each of the thousand files using a command line function?
Any help would be appreciated.
Thanks
========================
Just found the answer in my own notes (using sed)!
Sometimes it helps to explain the problem, just to get your mind to work. :-)
sed 's/\c@//' sitemap_001.xml > sitemap_001.modified
Last edited by andrew777; 09-05-2013 at 07:06 PM.
|