Ubuntu – Replace text inside quotes in vim

regexvim

I have a large sql file and I would like to rename the table name from `feedback` to `comments` but I don't want to replace the word feedback in case any row has that text so I was trying to select it with the quotes but vim can't find it. I'm using

:s/`feedback`/`comments`/

Any idea how to do it? maybe vim is not te best option for this?

Best Answer

While vim certainly is capable of doing this, my first thought would be to use sed or perl. Using sed:

sed -i.bak 's/`feedback`/`comments`/g' path/to/file

The -i flag makes sed perform operations in the files specified instead of writing to stdout (-isuffix makes a backup copy path/to/filesuffix).