Trying to remove this entire block of code from a script:
I am able to do so up until the linebreak and ending }
sed '/var gfjfgjk/,/appendChild(s);\n}/d'
how can I have it include the linebreak and } at the end
Thanks to @Wiktor Stribiżew link:
for i in $(grep -rl gfjfgjk) ; do if grep -m1 gfjfgjk $i >/dev/null 2>&1 ; then echo $i ; sed -i -e '1,6d;7s/^}//' $i ; fi; done
The only different really is, I wanted to make sure gfjfgjk matched the first line of the file in case it was injected somewhere else in the script and then sed removed the first 7 lines of legit code.
Don't do that, whatever it is you're trying to do there is a better way.