I've just recorded my zsh command trace into a file, in a list of timestamp-prefixed lines like this:
1728667090.254060000+_pyenv_virtualenv_hook:1> local ret=0
1728667090.254181000+_pyenv_virtualenv_hook:2> [ -n '' ']'
1728667090.255413000+_pyenv_virtualenv_hook:5> pyenv sh-activate --quiet
1728667090.256157000+pyenv:1> local command
1728667090.256659000+pyenv:2> command=sh-activate
There are hundreds of lines.
Now I would like to replace the starts of the lines with the difference between the timestamps
0+_pyenv_virtualenv_hook:1> local ret=0
0.0001199245453+_pyenv_virtualenv_hook:2> [ -n '' ']'
0.00123000145+_pyenv_virtualenv_hook:5> pyenv sh-activate --quiet
0.0007400512695+pyenv:1> local command
0.0004999637604+pyenv:2> command=sh-activate
How can I do that in vim?
I can pass it to external awk for example
:%!awk -F+ -v OFS=+ '{ current = $1 ; $1=""; printf "%.9f%s\n", current - prev, $0 ; prev = current }'
But that was a difficult command line to design, so I'm looking for simpler ways that might require less knowledge of other tools and syntaxes.