I have a text file with this format...
011000 001i 1111 011001 001i 0001 011010 001i 1111 011011 001i 1011 011100 001i 1111 011101 001i 1111 011110 001i 1001 011111 001i 1111 100000 001i 1111 100001 001i 1110 100001 000i 1000
Columns 1 and 3 are binary values which I would like to convert to hexadecimal (e.g. 011000 becomes 0x18, 1011 becomes 0xB).
This file will eventually be a C language header file (*.h) and the C language doesn't accept binary literals as far as I know without messing about with macros.
If I use Ctrl+v and then use the arrow keys to highlight a column of binary values, is there a set of Vim commands that can automatically go through and convert them all to hexadecimal?
The file isn't so large that I can't do it by hand but I'd love to know if there's a neat way to do this.
EDIT: If possible, solutions for Vim version 7.4.160 or earlier would be preferred but of course not mandatory. :)