Remove Strings from two patterns/characters with sed

kevo885

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 !

steeldriver

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.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

SED: remove pattern from two specific lines

From Dev

SED: remove pattern from two specific lines

From Dev

Attempting to remove string between two strings, whilst omitting the string if - sed

From Dev

Remove double slashes from several strings with sed (current idea not working)

From Dev

Grep/sed between two strings

From Dev

sed - Addressing using two strings

From Java

remove the last two characters from strings in list using python

From Dev

Linux sed remove two patterns

From Dev

how to remove double strings with sed grep awk

From Dev

Using sed to remove suffix to dynamic strings

From Dev

Remove formatting from strings

From Dev

Remove urls from strings

From Dev

Remove data between two strings

From Dev

Remove dot between two strings

From Dev

sed to Find and Replace chacters between two strings

From Dev

sed: remove numbers from file

From Dev

Remove filenames from Textfile with sed

From Dev

sed to remove from a character to a character

From Dev

Remove characters from string with sed

From Dev

Combine two regular expression rule in sed to remove unwanted characters from string

From Dev

sed/awk remove newline on two pattern matches

From Dev

How to remove everything between two characters with sed?

From Dev

How to remove everything between two characters with SED?

From Dev

Sed - remove last two character quotes and comma

From Dev

Join two regex from sed

From Java

Remove empty strings from a list of strings

From Dev

Python Remove List of Strings from List of Strings

From Dev

How to remove duplicate alphabets from two strings in java without any builtin functions?

From Dev

Remove all rows of lines between two strings from xml file using python

Related Related

HotTag

Archive