Douglas Muth on 3 Dec 2009 15:46:15 -0800


[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]

Re: [PLUG] sed newbie question


On Thu, Dec 3, 2009 at 6:30 PM, Michael Lazin <microlaser@gmail.com> wrote:
> Hi, I am interested in writing a shell script that will remove malicious
> iframes from peoples websites.  I am a scripting newbie and a sed newbie.  I
> decided to start by playing around with it.
>
> sed '/iframe/d' test.html
>
> cat test.html
> <iframe>frame src=http://evil.com/test</iframe>
>
> Why didn't this sed line delete the iframe line from my test file?

No idea, but I can tell you how I would do it:

cat test.html | sed -e s/iframe//g

Keep in mind that with that specific regexp, you'll be left with
broken HTML code.  I assume that's a proof of concept, though. :-)

Hope that helps,

-- Doug
___________________________________________________________________________
Philadelphia Linux Users Group         --        http://www.phillylinux.org
Announcements - http://lists.phillylinux.org/mailman/listinfo/plug-announce
General Discussion  --   http://lists.phillylinux.org/mailman/listinfo/plug