I have an record-based data file for an application that uses control
characters in some fields as flags for certain GUI options, e.g.:
^@
^A
It's barbaric to try and manipulate the data using the GUI, and I've
taken to vim'ing the text file. However, it's rough going because the
fields aren't vertically aligned. It would be much better if I could
massage the data in Excel, but the text import process seems to ignore
the control characters. I can use the vim command line to replace the
control characters with their visual counterpart i.e. ^@ is replaced
by carat and at-sign (I'll refer to these as fake control
characters). After importing into Excel and mushing the data, I
export it to text and use vim to clean it up, including converting the
fake control characters back to real control characters.
Therein lies my problem. When I use the command line, this works:
:% s=^@=^@=g
where the first ^@ is a fake control character while the second one is
real, obtained by prefixing the keystroke with ctrl-V. However, when
I try to put this command in a vim script that I can ":source", it is
interpretted as an error.
After much reading, I found that I can match ^@ with \%x00 in the
search string, but I haven't found a way to specify control characters
in the substitution string. Is there a way?
--
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
Monday, March 11, 2013
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment