Posted By

retry on 07/29/08


Tagged

text perl newline


Versions (?)

Remove newline characters from text


 / Published in: Perl
 

URL: http://forums.macosxhints.com/showpost.php?s=5db608600334b1707729f707eed4c7ca&p=459362&postcount=3

This Perl one-liner will remove all newline characters from a text file, replacing them with a space. In the source, all newline characters in the file gearlist.xml are replaced with spaces, and the original file is saved as gearlist.xml.bak

  1. $ perl -i.bak -pe 'chomp; print " ";' gear_list.xml

Report this snippet  

You need to login to post a comment.