Using sed
:
$ sed 's/VALUES[[:blank:]]*/VALUES/g' input >output
This will replace VALUES
followed by any number of whitespace characters (space or tab) with VALUES
, i.e. it will remove the whitespace.
If it's important that VALUES
is matched as a complete word, i.e. that whateverVALUES
is not matched, then insert a (beginning-of-)word boundary pattern before VALUES
:
$ sed 's/[[:<:]]VALUES[[:blank:]]*/VALUES/g' input >output
I will leave that out for the remainder of this answer.
For a more complicated value of VALUES
, it might be convenient to not have to type it twice:
$ sed 's/\(VALUES\)[[:blank:]]*/\1/g' input >output
This saves the VALUES
pattern and reuses it in the replacement.
If the pattern VALUES
is stored in the shell variable $values
:
$ sed "s/\($values\)[[:blank:]]*/\1/g" input >output
This transfers more or less directly into the Vim editor:
:%s/\(VALUES\)[[:blank:]]*/\1/
As I've never used Notepad++, I can only guess how to use it. One should apparently be able to press Ctrl+H and enter a search/find and replace pattern.
The search pattern may be (VALUES)[[:blank:]]*
while the replace pattern may be $1
. I have no way of testing this, sorry. If [[:blank:]]
doesn't work, try with [\t ]
.