I have the following links in a sql dump file(.sql).
I need to use ‘sed or grep with regex’ or something to replace each occurance of
#cheese-pasta= and whatever is after it including slash.
Example:
<a href="somelink/#cheese-pasta=2011-13\">
<a href="somelink/#cheese-pasta=\">
After the replacement, this will look like:
<a href="somelink/">
I could jus do somethin like sed /#cheese-pasta=/ /g
but, problem is that string is followed by other stuff and i want replace the stuff that’s following it upto the quote that ends the link tag ()
Thanks a lot.
You could write:
which will replace
#cheese-pasta=, followed by zero or more characters that aren’t backslashes, followed by a backslash.Alternatively:
(same concept, but using
"instead of\to find the end of the text to replace).