Re: A little bash/perl programming help?



Ivan Marsh wrote:

Okay, I admit it, I'm stumped.

....

123456789012345678901234567890123456789012345678901234567890
All work and no play makes jack a dull boy. All work and no

123456789012345678901234567
play makes jack a dull boy.
....

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.

I'm not that experienced as bash programming...ok I've got almost absolutely none...but as a thought of the logic involved, I'd be writing something along the lines of:

read line of text
do
print column numbering
print first 80 chars of text
strip top 80 chars off text
while text not null
repeat for all lines of text.

depending upon how string slicing like running off the end of a string, you may need to add in a length check when printing the first 80 chars; similarly for stripping off the top 80 chars. Handling EOF is left as an exercise for the reader.

(For the record: No, it's not homework. I'm trying to write a script I
just lost when a very old server died.)

That's the best excuse yet...much better than the dog ate my homework...[no, I'm training to be a teacher]

.



Relevant Pages

  • Re: Merging/Joining AoA
    ... I think you forgot to include the POD: ... All work and no play makes Jack a dull boy ...
    (comp.lang.perl.misc)
  • Re: Random
    ... swimming around in a box. ... All work and no play makes Jack a dull boy. ...
    (uk.rec.motorcycles)
  • Re: magic /dev/null
    ... I had a very large data file with hundreds of thousands of records, but my nawk script was only interested in about ten percent of them. ... All work and no play makes Jack a dull boy. ...
    (comp.unix.shell)
  • Partially visible frame
    ... * Too much work and no play makes Jack a dull boy. ... The way to go should be with partially visible frames. ...
    (comp.infosystems.www.authoring.html)
  • Re: Smiles The Fourth
    ... and occupied in the highest employment of ... "All work and no play makes jack a dull boy. ...
    (soc.culture.scottish)