Group moderators,
cant we have listserv(or whatever is used) runnning to fix it, if it is not so?
Amish.
Philip S Tellis wrote:
could you fix your line length?
Sometime Today, Amish Mehta assembled some asciibets to say:
Philip S Tellis wrote:
could you fix your line length?
cant we have listserv(or whatever is used) runnning to fix it, if it
Good idea. I can whip up a quick perl script to do it.
Stay tuned to this channel for my script.
Philip
On Sat, 7 Jul 2001, Philip S Tellis wrote:
could you fix your line length?
cant we have listserv(or whatever is used) runnning to fix it, if it
Good idea. I can whip up a quick perl script to do it.
Ok, here's my quick perl script. Took about 5 minutes to write, and about 15 mintes to test well. My test cases are in the attached file. Had to attach the file because it contains long lines that would have been wrapped if pasted into my mail client.
#!/usr/bin/perl -w
use strict; use Text::Wrap;
$Text::Wrap::columns=72;
while(<>) { s/^((?:[>}|%]\s?)+)(\s*)//o; my $leadin = $1 || ""; my $leadin_firstline = $leadin . ($2 || ""); print Text::Wrap::wrap($leadin_firstline, $leadin, $_); }
__END__
This handles a wide variety of mails. See the test cases for examples. Reads from stdin or files passed on the command line, writes to stdout.
Nagarjuna, is it possible to put this into mailman?
Philip
Sometime Today, Philip S Tellis assembled some asciibets to say:
On Sat, 7 Jul 2001, Philip S Tellis wrote:
could you fix your line length?
cant we have listserv(or whatever is used) runnning to fix it, if it
Good idea. I can whip up a quick perl script to do it.
And here's the one line version of the same program:
% perl -MText::Wrap=wrap,$columns -pe 'BEGIN {$columns=72} s/^((?:[>}|%]\s?)*)(\s*)(.+)$/wrap(($1||"").($2||""), $1||"", $3)/goose'
You can put all this on one line, and either pass it a file as an argument, or pipe the output to it:
% cat long_lines.txt | perl -MText::Wrap=wrap,$columns -pe 'BEGIN {$columns=72} s/^((?:[>}|%]\s?)*)(\s*)(.+)$/wrap(($1||"").($2||""), $1||"", $3)/goose'
or
% perl -MText::Wrap=wrap,$columns -pe 'BEGIN {$columns=72} s/^((?:[>}|%]\s?)*)(\s*)(.+)$/wrap(($1||"").($2||""), $1||"", $3)/goose' long_lines.txt
Works where I've tested it.
Philip