1 #!/bin/ksh 2 # reseq.ksh by Dan Martin (DRM/CTG) Fri Nov 17 15:28:33 CST 2000 3 infi="emsaccdata.txt" # Input File 4 clear 5 cat << BOX 6 7 ALERT: The file "$infi" will be read and the 8 Sequence Number (first field of each record) will be 9 renumbered beginning with the number you enter below. 10 11 File "$infi" will not be altered in any way. 12 13 BOX 14 ans='' 15 while [[ -z "$ans" ]] 16 do 17 echo "Enter New Sequence Number: \c" 18 read ans 19 done 20 outfi="`basename ${infi} .txt`_${ans}.txt" # Output File 21 awk -F"," -v seq="$ans" ' 22 { outs = sprintf("%s,", seq) 23 for (i = 2 ; i < NF; i++ ) outs = sprintf("%s%s,", outs, $i) 24 outs = sprintf("%s%s", outs, $NF) 25 ++seq 26 print outs 27 }' $infi >$outfi 28 echo "\nThe new Output File is: \"$outfi\".\n" 29 # EOF