Artificial intelligent assistant

converting epoch time from multiple lines in a log file I'm trying to find a way to batch convert the epoch timestamp from each line of a log file. From what I understand I should follow this process. 1. search the log for all iterations of the epoch timestamps 2. put them through a function that converts them to a human readable format 3. in place edit them back into the normal log file output Unfortunately I can't quite seem to get the formatting correct, here's a short snippet of the log file: "[1508371955] Auto-save of retention data completed successfully.", "[1508375555] Auto-save of retention data completed successfully.", "[1508379155] Auto-save of retention data completed successfully.", "[1508382755] Auto-save of retention data completed successfully.", "[1508386355] Auto-save of retention data completed successfully."

awk -F"[][]" '{cmd="date -d@" $2;cmd |getline $2; close(cmd)}1' infile

" Thu Oct 19 03:42:35 STD 2017 Auto-save of retention data completed successfully.",
" Thu Oct 19 04:42:35 STD 2017 Auto-save of retention data completed successfully.",
" Thu Oct 19 05:42:35 STD 2017 Auto-save of retention data completed successfully.",
" Thu Oct 19 06:42:35 STD 2017 Auto-save of retention data completed successfully.",
" Thu Oct 19 07:42:35 STD 2017 Auto-save of retention data completed successfully."


Here we set a shell command `date -d@$2` to a variable called `cmd`. Then with `cmd |getline $2` the `awk` reads a line and pass second field value to the `cmd` we open it, then we need close the command we opened via pipe, so we used `close(cmd)` here.

xcX3v84RxoQ-4GxG32940ukFUIEgYdPy bff7145d0d2e63f6345c6998d8cbf9ca