I was going to use a simple regex replacement like: :%s/\(.\{8}\)\
(.\{2}\)\(.\{3}\)/\1,\2,\3,/g This does work when only replacing
a small number of fields. I get 2 errors when I source a file with
the command for all 35 fields. The errors are:
E51: Too many \(
E476: Invalid command
Two questions because of all of this:
1) What is the limit of \( that can be used?
2) Is there a better way of delimiting the file?
1) I believe there's a limit of 9 fields (\1 through \9).
2) perhaps something like
:%s/\(\%8c\|\%10c\|\%13c\)/,/g
where you specify the columns at which you want to make your
replacements would scale to larger numbers of delimitings. It
uses absolute offsets (8, 10, 13) rather than relative offsets as
you listed (8, 2, 3). You should be able to just keep adding in
more columns delimited by the "\|".
You can read more at
:help /\%c
:help /bar
-tim