[EMAIL PROTECTED] schreef:
> :
>> perl -n00e'tr/\n/ /; print "$1\n" while s/^(.{0,69}\S)\s+//; print
>> "\n"'
>
> Since I'll use on both UNIX and DOS, can I put the $1 inside qq? as in
> ..print qq($1\n) while..
Yes you can. Or try it like this:
perl -wln00e'
tr/ \t\r\n/ /s;
print $1 while /
[EMAIL PROTECTED] am Freitag, 9. Februar 2007 14:11:
> I just found this one online but not sure I understand it
>
> what are the .{ and s/ called so I can look them up?
>
> http://user.it.uu.se/~matkin/programming/PERL/perl-cookbook.shtml
>
>perl5 -p000e 'tr/ \t\n\r/ /;s/(.{50,7
I just found this one online but not sure I understand it
what are the .{ and s/ called so I can look them up?
http://user.it.uu.se/~matkin/programming/PERL/perl-cookbook.shtml
perl5 -p000e 'tr/ \t\n\r/ /;s/(.{50,72})\s/$1\n/g;$_.="\n"x2'
>perl -n00e'tr/\n/ /; print "$1\n
>perl -n00e'tr/\n/ /; print "$1\n" while s/^(.{0,69}\S)\s+//; print "\n"'
Thanks! Far FAR better than anything I tried before.
However.. TR is killing paragraphs (double space is what I'm used to
because eMacs [and Greenview vEdit] stops reformatting when there is
an empty line) and includes carr
>perl -n00e'tr/\n/ /; print "$1\n" while s/^(.{0,69}\S)\s+//; print "\n"'
Since I'll use on both UNIX and DOS, can I put the $1 inside qq?
as in
..print qq($1\n) while..
--
- = -
Vasos Panagiotopoulos, Columbia'81+, Reagan, Mozart, Pindus, BioStrategist
On Thu, 08 Feb 2007 16:11:15 +, vjp2 wrote:
> Does anyone have a simple one-liner that can take a file
> of text and reformat each paragraph to a new column width?
CPAN: Text::Wrap.
--
Peter Scott
http://www.perlmedic.com/
http://www.perldebugged.com/
--
To unsubscribe, e-mail: [EMAIL PR
If you're on a Unix system, just use the 'fold' or 'fmt' commands in a
pipe open.
Kim Helliwell
LSI Logic, Inc
408 433 8475
[EMAIL PROTECTED]
-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
Sent: Thursday, February 08, 2007 8:11 AM
To: beginners@perl.org
Subject: Se
[EMAIL PROTECTED] wrote:
> Does anyone have a simple one-liner that can take a file
> of text and reformat each paragraph to a new column width?
This *may* work for you (for column width of 70.)
perl -n00e'tr/\n/ /; print "$1\n" while s/^(.{0,69}\S)\s+//; print "\n"'
John
--
Perl isn't a too