I've got a formatted file in this way:
1 223614 225119.537745 Engine45
2 223614 225121.082392 Engine45
3 223614 225124.440309 Engine45
4 223614 225124.763890 Engine45
5 223621 225124.933927 Engine46
6 223614 225124.934205 Engine45
7 223614 225125.354857 Engine45
8 223614 225127.603434 Engine45
.
.
.
I'm trying to make a awk/shell that takes that 1) verify columns 2 and 4 if there equal in the same line, and if this applies, 2) substract the second found value on column 2 with the first found column 1, should be like this:
1st line found by 1):
1 223614 225119.537745 Engine45
2nd line found by 1):
2 223614 225121.082392 Engine45
Output should be the answer of this:
225121.082392 - 225119.537745 = 1.544647
The next output should be :
3rd line find by 1):
3 223614 225124.440309 Engine45
4th line find by 1):
4 223614 225124.763890 Engine45
Output: 225124.763890 - 225124.440309 = 0.323581
And successively with all records in file provided.
I believe that 1) i could make it work but 2) is really getting hard for me but if someone can give a lead how to get could be very useful, i know basics from shell and awk if it helps, but i'm open to get done on another tools like perl .
Regards