cat A
ROW1COL1 ROW1COL2 2013-08-26 22:07:26 2013-08-26 22:07:26
ROW2COL1 ROW2COL2 2013-08-26 22:08:16 2013-08-26 22:08:20
(2 rows)
目的は、タイムスタンプ間の差が 3 秒を超える行をキャプチャすることです。
output here is
ROW2COL1 ROW2COL2 2013-08-26 22:08:16 2013-08-26 22:08:20
I tried the below.
bash-3.2$ echo $d1
08/28/2013 16:56:36
bash-3.2$ echo $d2
08/28/2013 16:56:44
bash-3.2$ date1=$(date -d "$d1" +%s)
bash-3.2$ date2=$(date -d "$d2" +%s)
bash-3.2$ diff=$(expr $date2 - $date1)
bash-3.2$ echo $diff
8
i am getting syntax error with the "%s" while using awk command.
Here are 2 variations i tried.but
awk '{t1=$3" "$4;t2=$5" "$6;time2=$(date -d "$t2" +%s);time1=$(date -d "$t1" +%s); if ($(expr $time2 - $time1) > 3) print $0 }' A