[Pdx-pm] command line options

Thomas J Keller kellert at ohsu.edu
Wed May 19 17:19:46 CDT 2004


Thanks Randal, Colin, and Bruce.
Weird, but (apparently) with \cM as a line-ending you have to specify 
both in ($/) w/ -015 and out ($\) w/ -l
  If not it either reads in as a single line, or outputs as a single 
line.
This worked:
perl -i.bak -015 -l -pe 's/\s+/\t/g' input.txt

Thanks again,
Tom K

On May 19, 2004, at 2:01 PM, Thomas J Keller wrote:

> 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.
> Thanks,
> Tom K.
>
>
> _______________________________________________
> Pdx-pm-list mailing list
> Pdx-pm-list at mail.pm.org
> http://mail.pm.org/mailman/listinfo/pdx-pm-list





More information about the Pdx-pm-list mailing list