[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Perl one liner requested
Robert Threet said:
> 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).
Odd, I've never heard of such a limit.
> 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?
Probably.
#!/usr/bin/perl
$chars=69; # One less than 70, to allow for the backslash.
while (<>)
{
chomp;
while (length($_)>$chars)
{
$space=rindex($_, " ", $chars);
$space=$chars if ($space<=0);
($x,$y)=/^(.{$space})\s*(.*)$/;
print $x, "\\\n";
$_=$y;
}
print $_, "\n";
}
Now that's completely, utterly untested code. YMMV.
> or...
>
> B. Implement another well known (although unknown to
> me) solution to this rather common problem?
Check the Majordomo FAQ, but, like I said, I've never heard of such a
thing.
Steve
--
steve@silug.org | Linux Users of Central Illinois
(618)398-7320 | Meetings the 4th Tuesday of every month
Steven Pritchard | http://www.luci.org/ for more info
-
To unsubscribe, send email to majordomo@luci.org with
"unsubscribe luci-discuss" in the body.