I have a log file which contains entries in this format:
Feb 15 14:28:37 [8085][8095] ssnotify.cpp:442:Send().....
How can I convert the date and time string to a date/time format so I can use it with other date/time commands within a bash script?
You can use the "date" command for this task.
Example:
user@host:so$ date --date="Feb 15 14:28:37"
jue feb 15 14:28:37 CET 2018
user@host:so$ date --date="Feb 15 14:28:37" +%s
1518701317
If you do: "man date" you will see all the options about how to format the date as you wish.
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.