Re: A little bash/perl programming help?




"Ivan Marsh" <annoyed@xxxxxxx> wrote in message news:pan.2007.09.27.16.30.11.967926@xxxxxxxxxx
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


--
I told you this was going to happen.

It looks to me like a perl script for this would be very easy to write.
I would need to know the format of the input text file, delimiters, etc.and what form the output would take - console, text file, report type file.
Logic would need to check line length, if > 80 take left 80 characters, process & print; if < 80 and not end of file read & concatenate next line, and loop.
I would use 2 lines for the column numbers, as
1 2
1234567890123
and find a good monospace font - courier usually works ok

Depending on the complexity of the input and output section, I see it taking 2-3 hours to write.
That means that a professional programmer can do in in 20 minutes....

Stuart




.



Relevant Pages

  • [NEWS] IBM Informix Web DataBlade Local Root by Design
    ... The following security advisory is sent to the securiteam mailing list, and can be found at the SecuriTeam web site: http://www.securiteam.com ... that ease development of "intelligent", interactive, Web-enabled database ... person who has access to change the Perl script. ...
    (Securiteam)
  • Re: A little bash/perl programming help?
    ... lengths with column numbering over each line and I just can't seem to get ... All work and no play makes jack a dull boy. ... Putting each 80 character section on a separate line with the column ... I'm trying to write a script I ...
    (alt.os.linux)
  • my perl script for ripping mp3s...aka MP3scRIPt
    ... This is a Perl script to convert audio cd tracks to mp3s. ... Possibly root privs to access the cdrom device ... - this is mainly a problem on 'variety cds', mp3 files suffering from this ill ...
    (comp.unix.bsd.freebsd.misc)
  • Re: Perl script to mimic uniq
    ... mdfoster44@netscape.net spits TOFU in my face: ... > # Perl script to find most common CS ... > So I'm back to my original script which looks like this. ... > identify a sequence as unique. ...
    (comp.lang.perl)
  • Re: Slow Performance When Using DBI, otherwise Not
    ... If I run the same perl script on the database server itself it runs ... check versions of DBI and DBD (I greped for version on every module under ...
    (perl.dbi.users)