What i would, is to calculate the time elapsed since the last time value. In other terms i need a difference between the [line+1] value and the [line] for line=0 to line=EOF.
The output should be :
00:02:04
00:02:17
....and so no
i've done a script that loads these value in a string....but then i can't operate on them by simple numeric aperator probably because i'm trying to subtract two character-strings.
This is what i've done
The first part of code (upper the END statement) seems to works fine (do you agree?)...the for cycle correctly populate the string array.
But when i try to assign the [I]string[i+1] - stringvalues to the diff array...doesn't work
Maybe there is some function for time operations?
Maybe i have to firstly convert the time value to UTC?
Both scripts run perfectly, and this could be sufficient, so thank you all so much!
Therefore the file that i'm being to parse tends to grow up every 30 min, so the fastest solution is still welcome (and i think that awk is the fastest way)
@cfajohnson
there is a little error :
- printf "$02d:%02d:%02d\n" "$hour" "$min" "$sec"
+ printf "%02d:%02d:%02d\n" "$hour" "$min" "$sec"
input:
Name|Operation
rec_10|1+2+2-
Output:
rec_10|1
Basically I am trying to calculate the result of "the path" in $3 where the operators follow the number and not preceding them like we normally do:
rec_10: +1+2-2=1
But I realise (I am sure there is a good reason for that) that awk... (7 Replies)
Hi
main object is categorize the difference of data-values (TLUFT02B - TLUFT12B).
herefor i read out data-files which are named
acording to the timeformat yyyymmddhhmm.
WR030B 266.48 Grad 0
WR050B 271.46 Grad 0
WR120B 268.11 Grad 0
WV030B 2.51 m/s ... (6 Replies)
Hi All,
I am using an awk script as below:
awk -F'|' 'BEGIN{OFS="|";} { if ($1==$3 && $3==$7 && $7==$13 && $2==$6 && $6==$11 && $15-$14+1==$11) print $0"|""TRUE"; else print $0"|""FALSE"; }' tempfile.txt
In above script, all conditions are being checked except the one which is... (4 Replies)
Hi, I need your help. I've got two files and i need to add 2nd line after occurrence of "Group No X" from data2.txt to 3rd line (after occurrence of "Group No X") from data1.txt. There is the same number of "Groups" in both files and the numbers of groups have the same pattern.
data1.txt
Group... (2 Replies)
Hello;
I have:
ll | grep -v ^d | awk '{print $9}'
rcx_access_report_fid.txt
rcx_access_report_hsi.txt
rcx_access_report_mmm.txt
rcx_access_report_qsc.txt
I want to get:
rcx_access_report_fid.txt
rcx_access_report_hsi
rcx_access_report_mmm
rcx_access_report_qsc
But when I try: (9 Replies)
I have a txt file with several columns and i want to peform an operation on two columns and output it to a new txt file .
file.txt
900.00000 1 1 1
500.00000
500.00000
100000.000
4
4
1.45257346E-07 899.10834 ... (4 Replies)