Here's what I've found one has to use in csh scripts (I presume it will
work with sh as well):
#!/bin/csh
awk 'BEGIN{id='"$2"';}{ \
printf(\"%8d %s\n\", id++, \$0); \
}' $1
The quotes around $2 are necessary because $2 might contain blanks...
Rik Verstraete. rik at UCLA-CS.ARPA
...!{ihnp4,ucbvax}!ucla-cs!rik