[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Perl one liner requested

On Tue, Aug 08, 2000 at 01:26:00PM -0700, Robert Threet wrote:
> What if you had, hypothetically, a Majordomo config
> file that had a bunch of text (50k) that contained
> many lines too long to be correctly parsed by
> Majordomo (seems to be a 70 character limit on lines).
> Would you:
> A. Write a Perl script to read in the lines in and
> write them out so that the lines over 70 had the
> proper slash at the end of the line to make it useable
> by Majordomo?

Since you require a one-liner, how about this:

cat file | perl -pe '$_=join("\n", split(/(.{69})/)); s/\n(.+)/$1\//;'

I'm gonna stop trying to figure out why it works though.  It's evil.

--Danny, who entertained himself if nothing else...
To unsubscribe, send email to majordomo@luci.org with
"unsubscribe luci-discuss" in the body.