txtcut—Text Preprocessor

Text files that contain blank lines, comments preceded by # (pound signs), a varying amount of whitespace between tokens, and other features to make them well-documented and readable (such as INI-style ASCII text files) are not easily processed by a Korn shell or REXX script and can even require a bit of extra work for Perl scripts. Additional logic can be used to skip over blank lines and remove comments, but this logic adds undesirable complexity and slow performance to the script.

One solution is txtcut. This program prepares a text file, stripping out comments and blank lines and handling simple strings. It was originally developed as a fast preprocessor for the AIX cut command. However, the output of txtcut can be piped into rxqueue, giving OS/2's REXX the ability to easily and quickly handle text-style INI-like files. Even awk and Perl (of which excellent Win32 and OS/2 ports exist) can benefit from txtcut.

Information can be stored in an INI-style text file in an easily- maintained and readable fashion using comments, strings, and blank space. The txtcut program preprocesses this text file, removing comments and blank lines, processing simple strings, and delimiting the tokens in a consistent manner. The tokens produced by txtcut can be easily extracted using the AIX cut command, a REXX script, or even an awk or Perl script.

The REXX, awk, Perl, and the Unix shells cover a lot of ground, but I have wished for a long time for the capabilities of txtcut to make the basic AIX, DOS, Win32, OS/2 toolsets more complete. I even maintain an AIX port of txtcut which I use daily and on which the DOS, Win32, and OS/2 ports are based. Text INI-style files that are highly readable by people and easily processed by command scripts: txtcut gives you the best of both worlds!



Subsections