== Another little script: _field_ In the footsteps of the [[first little script LittleScriptsI]], here's something I call _field_: #!/bin/sh fn="" for i in "$@"; do nf='$'$i if [ -z "$fn" ]; then fn="$nf" else fn="$fn, $nf" fi done exec awk "{print $fn}" (The _exec_ is another way around the [[Linux bash issue ../linux/BashPipes]].) You give it one or more field numbers, whereupon it reads standard input and prints just those fields to standard output. I wrote it because I got tired of typing '_awk "{print $7}"_' and the like all the time. Given _field_ and _[[howmany LittleScriptsI]]_, we can now write what I'll call _countup_: > #!/bin/sh > field "$@" | howmany Typical usage is things like '_countup 1 ) { chomp; @l = split; print join(" ", map {$l[$_]} @ARGV), "\n"; } If you give this a field that doesn't exist in (some or all) records, you get complaints about 'use of uninitialized variable in ...'. (There are more complicated constructs that will stop this, but I am interested in something *compact*, no larger than the Bourne shell script, and my Perl is sufficiently rusty that I can't see one right now.)