Re: A little bash/perl programming help?
- From: Mike <mikee@xxxxxxxxxxxx>
- Date: 27 Sep 2007 18:43:20 GMT
In article <pan.2007.09.27.16.30.11.967926@xxxxxxx>, Ivan Marsh wrote:
Okay, I admit it, I'm stumped.
I'm trying to write a script to parse out text files into 80 charter line
lengths with column numbering over each line and I just can't seem to get
the logic straight in my head. The desired output would look (something)
like:
123456789012345678901234567890123456789012345678901234567890
All work and no play makes jack a dull boy. All work and no
123456789012345678901234567
play makes jack a dull boy.
Putting each 80 character section on a separate line with the column
numbers over it.
Anyone have anything that does something like this? I was trying to write
it in bash but got more confused the more I worked on it. A perl example
would work too.
(For the record: No, it's not homework. I'm trying to write a script I
just lost when a very old server died.)
-thx
Do you want all text filled/formatted/compressed to 80 characters or
do you want each line regardless of line length?
(not tested, just thinking/typing aloud)
#!/usr/bin/perl
# $Id$
# $Log$
use strict;
while(<>) {
s/[\s\r\n]+$//o;
map { print ($_ % 10) } (1 .. scalar($_));
print "\n";
print $_, "\n";
}
--
Posted via a free Usenet account from http://www.teranews.com
.
- Follow-Ups:
- Re: A little bash/perl programming help?
- From: Ivan Marsh
- Re: A little bash/perl programming help?
- Prev by Date: Re: Customer Relationship Management (CRM) software
- Next by Date: Re: A little bash/perl programming help?
- Previous by thread: Customer Relationship Management (CRM) software
- Next by thread: Re: A little bash/perl programming help?
- Index(es):
Relevant Pages
|