In Ingos answer, which helped me a lot, I don't see how to reference a subpattern of the match and use it as an argument to the shell command ("produced by a console command with the expression as its argument").
In my case I had log lines of the following form: [<unix timestamp>] <message>
, i.e. [1406844000] foobar
. I wanted to prepend them with the time in a human readable form.
The following vim command matches the timestamp (submatch 1) and the message (the rest, submatch 2) and prepends the time string from date command:
:% s/^\[\(\d\+\)\] \(.*\)$/\=substitute(system('date -d @'.submatch(1)),'\n', '', 'g').': ['.submatch(1).'] '.submatch(2)/
[1406844000] foobar
gets Fr 1. Aug 00:00:00 CEST 2014: [1406844000] foobar
.
HTH