quickie filters

Lou Kates (louk@research.teleride.on.ca)
Mon, 6 Jul 1992 18:12:00 -0400

In perl there are flags to:

a. read the program from the command line

b. iterate over all the arguments using them as successive
input files

c. automatically split each input line

This makes it easy to write quickie filters.

Perhaps this might be made available for python too? For example,
suppose that -a is autosplit mode and -e reads the python program
from the next argument. Then one might do the following to get
the second field from each line and its square assuming that
Python puts the line into L and then splits it into a list of
fields F:

python -ae 'print F[1], F[1]*F[1]'

if you want to read the input from standard input, or

python -ae 'print F[1], F[1]*F[1]' infile.dat

if you want to name the file explicity.

---
Lou Kates, louk@research.teleride.on.ca