Hi,
I would like to make this script more flexible by changing the "1" in "NR==1" into a variable.
In1=`awk 'NR==1' file`
In2=`awk 'NR==3' file`
diff=`expr $In2 - $In1`
echo $diff
The file I need to work on is like this:
1 In1
2 Out1
3 In2
4 Out2
5 In3
6 Out3
7 In4
8 Out4
Basically I need to get the following differences:
In2 - In1
In3 - In2
In4 - In3
Out2 - Out1
Out3 - Out2
Out4 - Out3
Thanks!
I would like to make this script more flexible by changing the "1" in "NR==1" into a variable.
In1=`awk 'NR==1' file`
In2=`awk 'NR==3' file`
diff=`expr $In2 - $In1`
echo $diff
The file I need to work on is like this:
1 In1
2 Out1
3 In2
4 Out2
5 In3
6 Out3
7 In4
8 Out4
Basically I need to get the following differences:
In2 - In1
In3 - In2
In4 - In3
Out2 - Out1
Out3 - Out2
Out4 - Out3
Thanks!