Stories
Slash Boxes
Comments
NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.

All the Perl that's Practical to Extract and Report

use Perl Log In

Log In

[ Create a new account ]

paulm (5067)

paulm
  (email not shown publicly)
http://paulm.com/
Jabber: Tantrix@jabber.org

Hello! I'm Paul Makepeace [paulm.com], a regular on London.pm [pm.org]. Perl's my primary language I code in (since '95 I think); people even pay me [paulmakepeace.com] for it! Although I'd say I'm a developer I spend a substantial chunk of time being a sysadmin for my own machines (I'm also one of london.pm.org's root), all Debian boxen.

This journal is my first foray into a technical annotation of my perl life...

Journal of paulm (5067)

Friday May 28, 2004
09:36 AM

mac2unix

[ #18983 ]

A "zero script" hack (-e0) to convert in-place Macs' default line endings of \r to \n.

perl -le0 -015pi mac_file.txt

The order of the -l and -0 is important. -l assigns $\=$/ (output record sep = input record sep) and then the -015 sets input record separator to octal 15, aka dec 13 aka \r. So it's splitting the input on \r and outputting (via -p) with \n.

(I was puzzled for a while trying to squeeze even more characters out of it by wondering why -l0 was behaving differently to -l -0. -l takes a number too! So the 0 was a number not a command option.)

Can any more chars be shaved off?

The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
 Full
 Abbreviated
 Hidden
More | Login | Reply
Loading... please wait.