ff 03 04 ab 30 ab 03 41 ...
...
...
ff 03 04 ab 30 ...
all in plain ascii text. I'm looking for a switch that could change it
into the actual bytes those numbers represent.
Any ideas, without having to write a program for it?
The others gave sensible solutions. However, if you *must* do it
with vim...though it will mostly do what you describe, it may not
have 100% of the results you might actually want:
:%s/\x\x/\=nr2char('0x'.submatch(0))/g
will convert every pair of hexlets into the character they
represent. There might be problems with certain characters (0x00
and 0x0a come to mind as possible troublemakers).
Otherwise, it should do the trick.
You could even use the trinary operator to check for certain
ranges...something like
:%s/\x\x/('0x'.submatch(0) >=32 && '0x'.submatch(0) < 128)?
nr2char('0x'.submatch(0)) : submatch(0)
which will only convert characters in the given range.
I'd stick with the suggestions given by the others.
HTH,
-tim