I need to delete everything between the second = in a string and the first / in a string, but keep the = in place. I've tried many, many things, the most recent of which is sed -i 's/=[^/]*//
Sed to delete between delimiters but keep first delimter
shell script;text processing;sed
Started writing about look-ahead and look-behind assertions only to learn that sed doesn't support them! This should do the trick:sed -i 's!\(=[^=]*=\)[^/]*/!\1!'Since we use / character in the regexp, we change delimiter of s command to !\(=[^=]*=\) is a capture group that matches one = character followed by zero or more other characters followed by another = character. This part is needed to make sure there are two = characters before the to-be-deleted substring as you said you need to[^/]*/ matches whatever is between delimiters and the second delimiter\1 replaces the whole matched string with whatever matched the capture group \(=[^=]*=\)