1

Converting string date time to unix time in AWK

view story
linux-howto

http://www.unix.com – I’d like to convert a date string in the form of sun aug 19 09:03:10 EDT 2012, to unixtime timestamp using awk. I tried This is how each line of the file looks like, different date and time in this format Sun Aug 19 08:33:45 EDT 2012, user1(108.6.217.236) all: test on the 17th Through some help here, I was able to add delimiter and make it the way I want Sun Aug 19 08:33:45 EDT 2012~user1~192.168.1.1~test on the 17t Code:   awk '/all:/, …………………………. print $0 }' file1.txt I’d like to change the date part fields 1-6 to unixtime like 1344960720~user1~1 (HowTos)