Hello I am trying to append an incrimenting number to the end of each line I have it working with a temp file. But I want to do this without a temp file.
a=1 cat "file" | while read LINE do echo "$LINE, $a" >> filewithnumbers a=`expr $a + 1` done
ALL operations like this create a tmpfile somewhere. You can use perl -pie ' perl code here' Aslo consider nl:
nl file > newfile
With awk (tested with gawk and AIX awk) :
awk '{ line[NR]=$0 } END { for (i=1; i<=NR; i++) print line,i > FILENAME}' inputfile
Jean-Pierre.
With perl:
perl -i -ple'$_="$_ $."' file
awk '{print $0","NR}' infile
should work