Hi All..
I have a file with a number of non-unique entries as below:
1243
01:42:29,567 --> 01:42:32,108
blah blah ....
blah blah ..
1244
01:42:32,709 --> 01:42:34,921
blah blah ....
1245
01:42:35,214 --> 01:42:36,533
blah blah ....
blah blah ..
blah blah ....
blah blah ..
Question is: How can I modify these timings in hh:mm:ss format. Say if I need to add/subtract 30 seconds throughout the file.
I tried to start with this:
cat title | grep "\-\-\>" | awk -F"-->" '{print $1 $2}'
00:07:59,651 00:08:00,379
00:08:34,417 00:08:35,518
00:08:36,892 00:08:38,094
cat title | grep "\-\-\>" | awk -F"-->" '{print $1 $2}'
##VARIABLES hour, minute, second:
hour1=`cat title | grep "\-\-\>" | awk -F"-->" '{print $1 $2}' | cut -c 1,2`
hour2=`cat title | grep "\-\-\>" | awk -F"-->" '{print $1 $2}' | cut -c 15,16`
min1=`cat title | grep "\-\-\>" | awk -F"-->" '{print $1 $2}' | cut -c 4,5`
min2=`cat title | grep "\-\-\>" | awk -F"-->" '{print $1 $2}' | cut -c 18,19`
sec1=`cat title | grep "\-\-\>" | awk -F"-->" '{print $1 $2}' | cut -c 7,8`
sec2=`cat title | grep "\-\-\>" | awk -F"-->" '{print $1 $2}' | cut -c 21,22`
secnew1=`expr $sec1 + 30`
echo $secnew1
But got ERROR ALL AROUND.
AWK or SED preffered.
Or at least provide the logic.
Thanks a lot