bash - Need regex to remove a character in a datetime string in csv file -
i have csv file has following string:
"2016-10-25t14:07:49.298-07:00"
which replace with:
"2016-10-25", "14:07:49"
i matched original string regular expression:
([0-9]{4}-[0-9]{2}-[0-9]{2})[t]([0-9]{2}\:[0-9]{2}\:[0-9]{2})\.[0-9]{3}-07\:00
but need help
with awk
, assuming t
, .
unique
$ echo '"2016-10-25t14:07:49.298-07:00"' | awk -f'[t.]' '{print $1 "\", \"" $2 "\""}' "2016-10-25", "14:07:49"
-f'[t.]'
assignt
or.
field separator- then print first , second field required formatting
Comments
Post a Comment