[Pdx-pm] command line options

Thomas J Keller kellert at ohsu.edu
Wed May 19 16:01:22 CDT 2004

Hi all,
Simple question, but I can't find the answer.
I want to do the simplest thing: read a tab delimited file with Mac 
('\cM' carriage return) endings, and remove extra whitespace.

I wrote this on the command line:
perl -i.bak -pe 'local $/ = "\cM';  s/[\s\t]+/\t/g;' input.txt

It removes the extra whitespace, but doesn't keep the line endings, 
i.e. output is a single line.

I also tried the -0 option with "\cM", but that gave an error.

Please help.
Tom K.

More information about the Pdx-pm-list mailing list