kornShellScripter
Programmer
Hi!
I have the following ASCII file, which is a report output from another system, in a spool directory in Unix:
<lines above snipped>
Amount One Amount Two Amount Three
---------- ---------- ------------
1000.00 2000.00 3000.00
<lines below snipped>
What I need my korn shell script to do is pick out the second "Amount Two" value. For example:
read through the file
until it finds the header line "Amount One Amount Two Amount Three"
then
skip ahead two lines # because next line is just dashes
echo the_line | nawk '{print $2}'
quit reading through the file
done
I'm struggling how to code this logic...
(and it's the only method I've come up with too - if you've a better way, please feel free)
Can you advise, please?
I have the following ASCII file, which is a report output from another system, in a spool directory in Unix:
<lines above snipped>
Amount One Amount Two Amount Three
---------- ---------- ------------
1000.00 2000.00 3000.00
<lines below snipped>
What I need my korn shell script to do is pick out the second "Amount Two" value. For example:
read through the file
until it finds the header line "Amount One Amount Two Amount Three"
then
skip ahead two lines # because next line is just dashes
echo the_line | nawk '{print $2}'
quit reading through the file
done
I'm struggling how to code this logic...
(and it's the only method I've come up with too - if you've a better way, please feel free)
Can you advise, please?