Re: A little bash/perl programming help?
- From: Robert Newson <ReapNewsB@xxxxxxxxxxxxxxxxxxx>
- Date: Thu, 27 Sep 2007 19:20:34 GMT
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]
.
- Follow-Ups:
- Re: A little bash/perl programming help?
- From: Ivan Marsh
- Re: A little bash/perl programming help?
- Prev by Date: Re: A little bash/perl programming help?
- Next by Date: Re: A little bash/perl programming help?
- Previous by thread: Re: A little bash/perl programming help?
- Next by thread: Re: A little bash/perl programming help?
- Index(es):
Relevant Pages
|