Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Mailing Lists -> Oracle-L -> Unix - Nth occurance search in vi
I can't figure out how to find the Nth occurance of some hex value using the
substitute command. Suppose I have the following line:
ABCxDEFxGHIxMNO
Assume each "x" above is a hex 7F ( in vi it shows up as a '^J' ). I want to remember everything up to the 3rd occurance of "x", then insert "JKLx", and follow it with the remainder of the line to produce:
ABCxDEFxGHIxJKLxMNO
I want to do something like:
s/\(.*x\)\{3\}/&JKLx/
What Ctrl-V sequence produces a hex 7F?
and
How do I search for the Nth occurance of it?
Thanks,
Alan Martin
Database Administrator
GMAC Insurance Personal Lines
Winston-Salem, NC
Alan.Martin_at_GMACInsurance.com