CodeGnome, you're right, but let me show what I tried:
sed: Replace part of a line -this replaces after a pattern.
I tried to reverse the string to work for me ( replace after pattern, right )
echo “`grep "SS" file | sed -re '/([0-9]{1,3}\.){4}/p'
| grep -v drama`” | rev | sed -i …|rev
Problem with this idea is, it prints a duplicate of the matched line back in the file && cant double pipe sed -i without a file at the end ( err sed: no input file)
The winning code, after a lot of sed madness
sed -ri 'drama/! { /SS/ s/SS/S/;s/#// } ' file
due to
#*.* SSdrama:123
#*.* SSIP
" Do not match drama, in a line with SS pattern, for all else ( only one ocurrence in my sample) sed replace SS with S and # with '';Note that I didn't have to match the IP at the end at all.