file - Awk and double quoting -


i need awk , double quoting. have text file separated tab values (multiple lines).

ex.

22-03-2016 11:25 25 session reconnection succeeded user 10.10.10.10

now want change date notation. want above example 2016-03-22 11:25 (as in %y-%m-%d %h:%m)

i trying use awk (on mac) manually can change date with:

date -j -u -f "%d-%m-%y %h:%m" "22-03-2016 11:25" "+%y-%m-%d %h:%m" 

result: 2016-03-22 11:25

i struggling awk this. having problems quoting.

any other ways of doing appreciated!

regards,

ronald

ok,

so found solution using sed.. (had switch real linux enviroment.. ok)

using command: sed -i.bak -r 's/([0-9]{2})-([0-9]{2})-([0-9]{4})/\3-\2-\1/g' textfile

always funny how find answer right after post question....


Comments

Popular posts from this blog

sequelize.js - Sequelize group by with association includes id -

android - Robolectric "INTERNET permission is required" -

java - Android raising EPERM (Operation not permitted) when attempting to send UDP packet after network connection -