Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have a file that contains a SQL statement that looks like this that I paste in from some code. Can someone tell me the search/replace command for changing the + " values to blank or null?

I've tried various combinations of this but nothing seems to work

:%s\x ",,

  " select"
+ " col1 "
+ " col1 "
+ " col1 "
+ " col1 "
+ " from table"
share|improve this question



%s - Search the whole file

/ - Separator character

+\|" Search for the string + or the string "

/ - Separator character

- Replace with nothing

/ - Separator character

g - "Global" replace (without this it would only do one substitution per line)

Substitutions are in the form range to look at/what to look for/what to replace with/options

The separator character can be anything, / is just the most common. Personally, I like ; because it makes it easier to read when you have a bunch of backslashes.

share|improve this answer
An alternative: :%s/[+"]//g (a little easier to read) – jahroy May 31 '13 at 6:22

I think this is the simplest way:


This assumes that you want to remove all " and + characters.

share|improve this answer


:%s/+ "//

Assuming you want to remove all '+ "' strings

share|improve this answer
I believe the OP also wants to remove the " characters at the end of each line. – jahroy May 31 '13 at 6:39

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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