Hi All,
In last one week, i have posted many questions in this portal. At last i am succeeded to make my 1st unix script.
following are 2 points where my script is taking tooooo long.
- Print the total number of records excluding header & footer. I have found that awk 'END{print NR - 2}' <filename> will give exact result. But my file has 520 columns seperated with ^~^. while using this command, error is 'too long...... record'. so i have used like this.
a=` cut -d~ -f1 NAM2008101601.OUT |awk 'END{print NR - 2}' `
But this is taking too long.
- i need sum of amount column. So first i have cut that column & paste it in a file. Then i have calculated sum. But it is also taking long time.
cut -d~ -f27 $FILE_NAME | cut -c2-23 > amount
tot_val=`awk '{a+=$0}END{printf "%.5f\n",a}' amount`
Appriciate if someone can help me to get alternatives which speed up this process.
Thnaks
Amit