ALL
List Processing Tool

What is ALL ?
The Concept of ALL
The History of ALL
What can ALL do for me ?
Some Typical Tasks
How can I get ALL ? (Download)
[List of Downloads]

What is ALL ?

ALL is a is a list processing tool that runs as a command line program

ALL can manipulate and/or execute input records received via a pipe, from an input file, or from the console.

The ALL utility enables you to execute one or more operating system commands on all files in a given list of files.

Optionally, ALL creates a command file containing commands as well as user input required by interactive kinds of programs.

In addition to creating command files ALL can also produce a normal data file. Thus you can also use it to perform different kinds of transformations on files.

Program as well as user defined fields found in the records of the input file can be used to construct commands for execution or to produce data files. In this respect, ALL can be a faster and easier to use substitute for programs such as AWK or Perl whenever its more limited facilities are sufficient for your purposes.

[Table of Contents]

The Concept of ALL

Looking at the variety of tasks that ALL can execute it seems hard to see a real concept behind it. There is one, however, and because it has so much potential there are very many ways in which ALL can help you solve everyday computing problems.

The concept is that each input record is broken apart into a standard set of fields with the added possibilitity of user defined fields. The contents of these fields can then be manipulated in a number of ways and be mixed with literal string data to form a new record. This new record can be written to some output file and/or be executed as an operating system command.

[Table of Contents]

The History of ALL

While is seems a bit too much to talk about a "history" in this case, it may still help you to understand what ALL is and what it does when you know how it developed.

The initial goal when developing ALL was to have a tool that would be able to execute one or more operating system commands on an arbitrary list of files. Thus ALL could only read and understand file specifications from a file or a pipe, at first. Such file specifications could be generated manually or by programs like DIR (on DOS) or DIRECTORY (on OpenVMS).

ALL was later enhanced to understand wildcard file specifications so that it would not always require its input to come from another command that could produce such input files.

As the idea of constructing flexible commands from a file specification also seemed promising for the transformation of normal data, especially when it existed in a somewhat consistent format, ALL was enhanced to be able to read input in a prescribed fashion, allowing use of the input fields in the output.

[Table of Contents]

What can ALL do for me ?

ALL lets you do list processing in a number of ways. The following actions are possible:

[Table of Contents]

Some Typical Tasks

It might be subject to discussion whether the following examples are the best way to do what is done in each individual case. Fact is, that I used ALL in the ways shown and it worked

Run a number of programs and delete them selectively
Rename files according to their ordinal number in a list of files
Add line numbers to a file
Copy files whose name contains a specific string
Create an HTML file to browse through graphics
Delete files of any given length (including zero-byte (empty) files)

Run a number of programs and delete them selectively

Execute all basic programs in the current directory one after the other and after exiting each program ask whether the program should be deleted.

ALL can do this with a command like the following for each file:

all *.bas "gwbasic !fn! & del !fs!" /C

[Table of Tasks] [Table of Contents]

Rename files according to their ordinal number in a list of files

The situation is that we have a number of MIDI sound files which we want to play on our home page, depending on the second of the minute in which the sound file is called. We do this in JavaScript but do not want to use an array but just the value of the current second.

Thus we need the second in the file name, but we have only lots of sound files with different names. This task is effected as follows:

all *.mid "ren !fn!!fe! number!ln!" -o -e

The following commands might be executed:

ren B10201.MID number1.mid
ren AIRGSTR.MID number2.mid
ren BACHVI.MID number3.mid
ren BB5M1.MID number4.mid
ren B1006A1.MID number5.mid
ren BACH-2.MID number6.mid
ren BACHA1.MID number7.mid
ren BACHA3.MID number8.mid
ren BACHJESU.MID number9.mid
ren PREL2-2.MID number10.mid
ren APLICA.MID number11.mid

Because the seconds in a minute start with 0, not with 1, the output would not be readily usable. The next ALL command results in what we want:

all *.mid "ren !fn!!fe! number!ln!" -o -e -B0

The -B option sets the numbering base from the default value of 1 to the desired value of 0. The output looks like this now:

ren B10201.MID number0.mid
ren AIRGSTR.MID number1.mid
ren BACHVI.MID number2.mid
ren BB5M1.MID number3.mid
ren B1006A1.MID number4.mid
ren BACH-2.MID number5.mid
ren BACHA1.MID number6.mid
ren BACHA3.MID number7.mid
ren BACHJESU.MID number8.mid
ren PREL2-2.MID number9.mid
ren APLICA.MID number10.mid

Now we have exactly the result which was needed.

[Table of Tasks] [Table of Contents]

Add line numbers to a file

In order to prefix the records in a file with line numbers the following ALL command can be used:

all lineno.dat "!n!: !r!" -b -t -olineno.out -v0

The result of the above command will look as follows:

00000001: This is line 1
00000002:
00000003: This is line 2
00000004:
00000005: This is line 3
00000006:
00000007: This is line 4
00000008:
00000009: This is line 5
00000010:
00000011: This is line 6
00000012:
00000013: This is line 7
00000014:
00000015: This is line 8
00000016:
00000017: This is line 9
00000018:
00000019: This is line 10
00000020:


The input file is shown below. It was generated by another ALL command:

int 10 | all "This is line !ln!~n" -v0 -t -olineno.dat

This is line 1

This is line 2

This is line 3

This is line 4

This is line 5

This is line 6

This is line 7

This is line 8

This is line 9

This is line 10

The int program just prints the numbers from 1 to 10 each on a line of its own thus giving ALL 10 input records to work with. The contents, which happens to subsequent numbers in this case, does not matter..

[Table of Tasks] [Table of Contents]

Copy files whose name contains a specific string

Under Unix, and maybe other operating systems, this could be effected by a command like the following where the string searched might be "test" or "tast":

cp *t[e|a]st* ..

The command copies the files in question to the parent directory. Under MS-DOS, this would not be possible, because wildcard handling is very poor.

ALL can do this with a command like the following:

dir /b | grep "t[e|a]st" | all "copy !fn!!fe! .." -o -e -c

The combined -o -e options create a command file (-o) and execute it (-e) directly. The -c option lets ALL ask you for confirmation before copying.

[Table of Tasks] [Table of Contents]

Create an HTML file to browse through graphics

The easiest way to look at a larger number of GIF or JPEG files will probably be to load them into a WWW browser. The browser, however, requires specific HTML code to be put around the graphics.

ALL can do this with a template file and a command like the following:

dir *.gif *.jpeg /b | all -Timg2html.tpl -S# -E$ -t "-p<HTML><BODY>" "-a</BODY></HTML>"

The template file img2html.tpl would look like this:

<IMG SRC="!r!">!;r!</IMG><BR>

As the template file is very small it would not have been strictly necessary. The example illustrates the use of a template file, though.

Some people may find the syntax needed here somewhat weird. With a bit of practice it is quite easy to understand. Such code would be embedded in a batch file anyway. The actual call of such a batch file would look like

img2html *.gif *.jpeg > images.htm

First, the DIR command makes a list of the names of all GIF and JPEG files in the current directory which it passes to ALL. ALL accepts the input data and consults a template file in order to find out how to output the data. Together with the strings to place at the beginning (-a option) and at the end of the input file (-p option) the data found in the input enriched with some HTML code make up the output HTML file.

ALL uses some special characters like the split character that is set with the -S option and tells ALL which character in the input means the beginning of a new command or record. Another special character is the escape character denoted by the -E option. This character is used in special sequences like ~n (new line) and is a tilde by default. Because both characters have been found in file names, however, we set some less often used ones instead.

The resulting HTML file looks like this:

<HTML><BODY>
<IMG SRC="ArrowLeft.gif">arrowleft.gif</IMG><BR>
<IMG SRC="ArrowRight.gif">arrowright.gif</IMG><BR>
<IMG SRC="backarrow.gif">backarrow.gif</IMG><BR>
<IMG SRC="Background.gif">background.gif</IMG><BR>
<IMG SRC="banner_contact.gif">banner_contact.gif</IMG><BR>
<IMG SRC="gradient(1).gif">gradient(1).gif</IMG><BR>
<IMG SRC="H-MerkurWeihnachten.gif">h-merkurweihnachten.gif</IMG><BR>
<IMG SRC="bg_selbstdar.jpeg">bg_selbstdar.jpeg</IMG><BR>
</BODY></HTML>

[Table of Tasks] [Table of Contents]

Delete files of any given length (including zero-byte (empty) files)

ALL can delete files of any given length including zero-byte files, which probably is the predominant case.

In order to do this, ALL would use the output of the DOS DIR command in its standard form. In this output, the file size can always be found in a specific column. ALL extracts the text in this column and compares it to a user specified string. If they match ALL performs the action specified for this case.

ALL can do this with a command like the following:

dir *.txt | all "echo Deleting !p4!&del !p4!" -v0 -s5 -mp3=7 -t

The command tells ALL to only consider those records of the input which have a 7 in column 3 (p3). The file name found in column 4 of a matching record, that is, a file that is seven bytes long, is inserted in the command template and produces the output shown further down. The -s option instructs ALL to skip the first five input records (the header lines of the DIR command), which are not needed. The -t option prevents ALL from actually executing the command.

The above command was used in the DOS box of a Windows NT 4.0 system. The output of the command dir *.txt looked like this on this system:

 Volume in drive I is DRIVE_I
 Volume Serial Number is 0041-0286

 Directory of I:\ALL\TST\DOS\SIZEDEP

01/06/98  02:32p                     4 04.txt
01/06/98  02:32p                     5 05.txt
01/06/98  02:32p                     6 06.txt
01/06/98  02:32p                     7 07.txt
01/06/98  02:32p                     8 08.txt
01/06/98  02:32p                     9 09.txt
01/06/98  02:32p                    10 10.txt
01/06/98  02:32p                    11 11.txt
01/06/98  02:32p                    12 12.txt
01/06/98  02:32p                    13 13.txt
              10 File(s)             85 bytes
                             56,098,816 bytes free

By the way: the files listed above were not created manually but by another ALL command which worked on a data file containing the strings to insert into the files. The command was:

all create.dat "echo !r!> !n[7,2]!.txt" -o -e -B4

The output of the relevant ALL command dir *.txt | all "echo Deleting !p4!&del !p4!" -v0 -s5 -mp3=7 -t was as follows:

echo Deleting 07.txt
del 07.txt



[Table of Tasks] [Table of Contents]

How can I get ALL ? (Download)

The evaluation version of ALL can do everything that the registered version can do except that the number of input records is limited to 50. The evaluation version of ALL can be downloaded here.

A single user license of ALL will cost US$ 12 once I make it available. This should be quite soon, after the payment schemes needed (like CompuServe GO SWREG and MasterCard/VISA) are in place. If you are in dire need of ALL send me an email and I'll find a way to get it to you.

From within Germany, you can send me a Verrechnungsscheck made out to

Michael Walter
Spieljochstr. 38
81825 München

The sum to insert is 20 German marks.

[List of Downloads] [Table of Contents]