Fred Stluka on 4 Dec 2009 12:58:22 -0800


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

Re: [PLUG] sed newbie question


Thinking outside the box...

Simply use sed to change iframe to NOTiframe.

HTML parsers ignore unknown tags like "
NOTiframe", so you haven't
introduced an HTML syntax error.

This way, it is obvious what the HTML used to look like (nothing
is deleted), to you or anyone else who may have to look at it
sometime and understand what happened.

Don't have to worry about multiple lines, or whitespace, or line
breaks, etc.  None of these are allowed within the HTML tag name
"iframe".
--Fred
---------------------------------------------------------------------
Fred Stluka -- mailto:fred@bristle.com -- http://bristle.com/~fred/
Bristle Software, Inc -- http://bristle.com -- Glad to be of service!
---------------------------------------------------------------------


Michael Lazin wrote:

Yeah, it's just a proof of concept, obviously this is gonna take some work.  Out of curiosity is there a way to insert with sed, so you could do something like inserting <!-- --> around the <iframe></iframe> tags?  This might be better than removing a whole line of code.

On Dec 3, 2009 6:46 PM, "Douglas Muth" <doug.muth@gmail.com> wrote:

On Thu, Dec 3, 2009 at 6:30 PM, Michael Lazin <microlaser@gmail.com> wrote: > Hi, I am interested in...

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

___________________________________________________________________________ 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
___________________________________________________________________________
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