Introduction
In several jobs now, I've realised the importance of numbering sections in test scripts and specifications and stuff to clear up misunderstandings.
But it sure is a pain having to alter text files when someone adds an extra step or section or item...

So I made this. It took about 30 mins to write and test and it reminded me of all the fun you can have with formats.

Usage
Write a text file like this:

Of course it's simple, I am ;)

Example use for script
S:Easy to write
T:takes little time
I tied a file suffix in vim
Add a few macros
It's a doddle
T:I hate using word
I hate Microsoft
It sucks, for one
Okay this isn't great but
Did I ever say it was?

S:Easy to deploy
T:Just wanted to show
Several sections in action
Yeah it won't stretch over several lines yet :(

And cat it through the script like this:
cat example | ./checklist > output.txt

Feel free to hack it, ransack or ignore it ;)

#!/usr/bin/perl -w use strict; $==shift || 60;# Set lines per page $^='H';# Set header format %_=map{$_,0}('S'..'U'); # Make a list formats my $title=<>; # Set title to first line of input doc # Header format format H= + Page: @>>>> + $% @>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> +>>>>>>>>>>>>>>>>>>>>>>>>>>>> + `date` @||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||| +||||||||||||||||||||||||||||| $title @||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||| +||||||||||||||||||||||||||||| '=' x (length($title)-1) # that or chomp $ti +tle . # Section format format S= SECTION @# : @<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< $_{S}, $_ ====================================================================== +============================ + Use box indicate outcome. . # Test section format format T= @>>>>>>>>>>>>> @#.@# : @<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< +<<<<<<<<<<<<<<<<<<<<<<<<<<<< 'TEST',$_{S},$_{T}, $_ . # Item section format format U= @>>>>>>>>>>>>>>>>>>>> @#.@#.@# : @<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< +<<<<<<<<<<<<<<<<<<<<<<<<<[ ] 'STEP',$_{S},$_{T},$_{U}, $_ . for(<>){ # until EOF chomp; # strip newline ($_,$~)=/:/?($',$`):($_,'U'); # choose format and output line. /\w/ or next; # if it's empty, move on. $_{$~=~/S/?'T':'U'}=0 if $~!~/U/; # Reset the next section counte +r in order $_{$~}++; # increment section counter write; # output template }

--

Brother Frankus.

¤

Replies are listed 'Best First'.
Re: By the numbers reports
by tbone1 (Monsignor) on Aug 08, 2002 at 13:11 UTC
    Brother Frankus, my boss was talking about something vaguely like this the other day, throwing out words like 'streamline', 'standardize', 'flexibility' (not seeing these last two as the contradiction they can be), etc. I was more or less charged with doing something about it. This isn't precisely what we need, but you have saved me a good amount of drudgery and show leather. May your god (if any) bless you!

    --
    tbone1
    As God is my witness, I thought turkeys could fly.