Reputation: 2001
I have a list of files with strings like {{abc-exfs-value}}
. The sub string abc differs in each of the file. For example, a regex search (java) like: \{\{*-exfs-value\}\}
will return all the strings that is of concern here. How to proceed on replacing all those strings that match the regex pattern in files in linux?
I am able to get the list of files using grep -R '\-exfs\-value' .
. Using sed how to replace the strings?
Upvotes: 1
Views: 2361
Reputation: 246744
I would think this is what's needed:
sed -i.bak 's/\({{\)[[:alnum:]]\+\(-exfs-value}}\)/\1xyz\2/g' file1 file2 ...
Upvotes: 1