Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

the input would be like this in a file:


and the parsing looks like this:

sed -i "s/<script//g" SOMETHING.html

the "/gi" is not good, because OpenWrt doesn't knows it (busybox..):

sed: bad option in substitution expression

Does anybody know how could i delete e.g.: the:

< sCripT or 

with one sed?

Plus (the really thing i need): how could i delete the whole line containing

"<sCripT" or 
"<scRiPt", etc.?
share|improve this question
up vote 2 down vote accepted

I can't see a way using Busybox's sed, but you could use Busybox's sh and grep like this:

while IFS='
' read -r line; do
    printf "%s\n" "$line" | grep -qi '<script' || printf "%s\n" "$line"
done <SOMETHING.html >SOMETHING.html.tmp
mv SOMETHING.html.tmp SOMETHING.html
share|improve this answer
Correct (after minor fixes), but overly complicated compared with asoundmove's answer. There is a way with sed, but it's ugly: sed -e '/<[Ss][Cc][Rr][Ii][Pp][Tt]/d'. – Gilles Mar 24 '11 at 20:02
@Gilles: I agree, asoundmove's is much simpler. – Mikel Mar 25 '11 at 0:24

Does the Busybox not have grep -v?

This should do the job in one simple command:

grep -vi "<[ \t]*script" SOMETHING.html
share|improve this answer
Yes, Busybox has grep -v as a non-optional feature. – Gilles Mar 24 '11 at 20:04

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.