I want to remove the string inside two patterns/characters, so if I have a file containing "% Blah blah %
i want to remove Blah blah
as well as the pattern character in this case it will be % %
. so after deleting the string all thats left will be ""
.
Im doing: sed -E '/"%,%"/d' file
but that doesn't seem to delete the string.
Any help would be appreciated !
Assuming that % Blah blah %
cannot break across a line boundary, and that Blah blah
does not itself contain %
, then you can use
sed 's/%[^%]*%//' file
Add the g
modifier if you need to replace more than one instance of the pattern per line.
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments