Changing separator with Perl
Tagged with: command, file, join, lines, Perl, replace
Wednesday, March 7th, 2007 12:07 PM
This will join all lines of a file together. Sometimes I have a list of something in a file, one line per item and want to convert it to a comma(colon,tab)-separated line (with no trailing separator of course) that can be used as a command-line parameter to some other tool.
perl -e '@_=; chomp(@_); print join(";",@_);' < data_file