I need to remove the timezone section from the timestamp using awk.
File entry:
2015-09-30 07:01:33,979 test1
Expected output:
2015-09-30 07:01:33 test1
awk
to the rescue!
$ echo "2015-09-30 07:01:33,979 test1" | awk -F"[ ,]" '{print $1,$2,$4}'
2015-09-30 07:01:33 test1
or
$ echo "2015-09-30 07:01:33,979 test1" | awk '{sub(/,.* /," ")}1'
2015-09-30 07:01:33 test1
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.