The code may be described as follows:
- Define a work area, or alias, for the data file, calling it 'pleac'.
- Open the text file within that work area, using define-file-lit.
- Start a loop which iterates through an enumeration of the lines of data in the work area.
- Let a variable contain the data in the current line of the work area.
- Test whether the regular expression works for the current line.
- If it does work, let a variable contain the number found, ...
- ... turn off any output redirection, ...
- ... and redirect output to the file 'pleac_perl_' + the number found (in the same directory as the script).
- End of the if.
- Output the contents of the line.
- End of the iteration.
© Copyright Bruce M. Axtens, 2007
2 comments:
Except for the syntax, this doesn't seem any simpler or more powerful than the equivalent written in python or perl.
This is not simple and powerful. It's a retarded piece of incomprehensible babble.
Why don't you wake up from your drug-induced stupor and check out how this kind of completely trivial task is done in any of the modern, popular scripting languages.
Or even not so modern. A solution in the Unix language awk would be much nicer. Heck, sed.
Post a Comment