oskar wrote:
Hello
After searching the Internet for 3 hours and not finding an answer here the
question:
I have a vim script which I want to use to search & replace a part out of a
given line. The fields in the line are based on field length and the field I
want to change starts at position 33 and ends after 4 charachter.
A regex search is not appropriet, as the string I am looking for may occur
in another field in the same line but shoult not be changed here. I already
tried substitute() and had a look to the normal command :s with a subset,
but none of them worked for me.
Any suggestions?
Try this command:
:s/^\(.\{32\}\)PATT/\1REPL/
the above command is a substitute (:s) that executes on the current
line, and matches the first 32 characters on the line followed by PATT
(replace with your desired pattern), and then replaces it with whatever
the first 32 characters was and the replacement string (REPL). The rest
of the line is left unchanged.
Hope that helps
--
Albie Janse van Rensburg