sean finney on 3 Dec 2009 16:29:51 -0800

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

Re: [PLUG] sed newbie question

On Thu, Dec 03, 2009 at 06:30:52PM -0500, Michael Lazin 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=</iframe>
> Why didn't this sed line delete the iframe line from my test file?

because sed by default is a stream editor, not a file editor.  if you want
to edit the file in place, throw a "-i" at it (assuming fairly recent
and GNU sed).  

that se^Haid, if you're trying to do anything remotely more
complicated with the html (like catching multiline or nested or posibly
non-standard or mal-formed tags), i think you're on a long downward
spiral of doom trying to send it through a shell script :)


Attachment: signature.asc
Description: Digital signature

Philadelphia Linux Users Group         --
Announcements -
General Discussion  --