I have

"012-0738-32"],[ "4", "Beacon

I want

"4", "Beacon

],[+ space replaced with \r

  • 4
    Did you try to use the :s command? Or anything else? Did you get stuck somewhere? It's better to post what you've tried, so that people can point out what your mistake was, rather than just provide a "here copy this"-sort of answer. Jan 4 '17 at 13:53

You need to escape the opening square bracket: :s/],\[ /\r

  • Thank you @Luc Hermitte. For all line in a file :%s/],\[ /\r
    – alhelal
    Jan 8 '17 at 10:54

A visual way to handle this is to

1) search:


2) select the matched text


3) substitute text

s and insert the text you want

4) Repeat if needed

You can advance to next match using n then . to repeat your last substitution.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.