CyberAngel
October 17th, 2007, 04:05 AM
Hello,
I have a file like the following:
100 0 some-data
100 1 some-data
100 2 some-data
100 3 some-data
100 4 some-data
100 5 some-data
100 6 some-data
100 7 some-data
...
...
100 59 some-data
101 0 some-data
...
...
1304 0 some-data
1304 1 some-data
....
Those data are retrieved from a data logger.
In the first column it is the hour and minutes (GMT time).
In the second column these are the seconds and in the last one the date retrieved.
I want an awk script (or something else anyway but in bash scripting language) to parse the hole file for misconceptions, because it might be a single second that the data logger will not retrieve data so I want to fix the output file as follows.
What do I need the script to do:
It will be checking the first and the second columns to see if any seconds are missing and it will fill with zero data lines:
Take a look at the following example:
...
...
1303 58 some-data
1304 0 some-data
1304 1 some-data
1304 2 some-data
1304 3 some-data
1304 5 some-data
1304 6 some-data
...
...
In the above example as you can see is missing the data line for 13:03:59 and 13:04:04
So if the above is the input file I want an output file as following:
...
...
1303 58 some-data
1303 59 zero-data
1304 0 some-data
1304 1 some-data
1304 2 some-data
1304 3 some-data
1304 4 zero-data
1304 5 some-data
1304 6 some-data
...
...
Thanks!
I have a file like the following:
100 0 some-data
100 1 some-data
100 2 some-data
100 3 some-data
100 4 some-data
100 5 some-data
100 6 some-data
100 7 some-data
...
...
100 59 some-data
101 0 some-data
...
...
1304 0 some-data
1304 1 some-data
....
Those data are retrieved from a data logger.
In the first column it is the hour and minutes (GMT time).
In the second column these are the seconds and in the last one the date retrieved.
I want an awk script (or something else anyway but in bash scripting language) to parse the hole file for misconceptions, because it might be a single second that the data logger will not retrieve data so I want to fix the output file as follows.
What do I need the script to do:
It will be checking the first and the second columns to see if any seconds are missing and it will fill with zero data lines:
Take a look at the following example:
...
...
1303 58 some-data
1304 0 some-data
1304 1 some-data
1304 2 some-data
1304 3 some-data
1304 5 some-data
1304 6 some-data
...
...
In the above example as you can see is missing the data line for 13:03:59 and 13:04:04
So if the above is the input file I want an output file as following:
...
...
1303 58 some-data
1303 59 zero-data
1304 0 some-data
1304 1 some-data
1304 2 some-data
1304 3 some-data
1304 4 zero-data
1304 5 some-data
1304 6 some-data
...
...
Thanks!