


This transfers more or less directly into the Vim editor: :%s/\(VALUES\)]*/\1/Īs I've never used Notepad++, I can only guess how to use it. If the pattern VALUES is stored in the shell variable $values: $ sed "s/\($values\)]*/\1/g" input >output This saves the VALUES pattern and reuses it in the replacement. I will leave that out for the remainder of this answer.įor a more complicated value of VALUES, it might be convenient to not have to type it twice: $ sed 's/\(VALUES\)]*/\1/g' input >output that whateverVALUES is not matched, then insert a (beginning-of-)word boundary pattern before VALUES: $ sed 's/[[:output If it's important that VALUES is matched as a complete word, i.e. This will replace VALUES followed by any number of whitespace characters (space or tab) with VALUES, i.e. Using sed: $ sed 's/VALUES]*/VALUES/g' input >output
