How do I replace a substring by the output of a shell command with sed, awk or such?
I'd like to use sed or any command line tool to replace parts of lines by the output of shell commands. For example: Replace linux epochs by human-readable timestamps, by calling date Replace hexa dumps of a specific protocol packets by their decoded counterparts, by calling an in-house decoder sed seems best fitted because it allows to match patterns and reformat other things too, like moving bits of matches around, but is not mandatory. Here is a simplified example: echo "timestamp = 1234567890" | sed "s/timestamp = \(.*\)/timestamp = $(date -u --d @\1 "+%Y-%m-%d %T")/g" Of course, the $(...