I have a tab delimited file with timestamp in third field which I need to change into epoch in bash.
Sample Input:
xyz@gmail.com SALE 2017-04-26 12:47:27 30.0 1 201704
xyz@gmail.com SALE 2017-04-26 12:46:15 20.0 2 201704
xyz@gmail.com PAYBACK 2017-04-18 08:02:31 95.0 3 201704
xyz@gmail.com SEND 2017-04-18 08:00:37 4800.0 4 201704
xyz@gmail.com SEND 2017-04-17 14:59:34 4900.0 5 201704
I tried awk 'BEGIN {IFS="\t"} {$3=system("date -d \""$3"\" '+%s'");print}' file
which gives the closest results but it displays epoch in one line then shows the record again in a newline with timestamp value as zero. I require all in a single record with third field replaced.