Date: Fri, 14 Jan 2011 00:01:51 -0800 (PST) From: "Chris H" <chris#@1command.com> To: freebsd-stable@freebsd.org Subject: Re: sed is broken under freebsd? Message-ID: <0652cc7e3380a4dd8333ff7739396560.HRCIM@webmail.1command.com> In-Reply-To: <E76031CC-3511-4896-B167-F2693A78EDA8@solfertje.student.utwente.nl> References: <AANLkTin=Jeah8UX7QB-Uk1x9VYBtnFw=nX8fptLJW%2Bs4@mail.gmail.com> <20110112070009.GB20924@lava.net> <20110112223229.GB65854@rancor.immure.com> <a3ab8ba12e7c03cac40bc4baf1829f90.HRCIM@webmail.1command.com> <E76031CC-3511-4896-B167-F2693A78EDA8@solfertje.student.utwente.nl>
next in thread | previous in thread | raw e-mail | index | archive | help
On Thu, January 13, 2011 11:45 am, Alban Hertroys wrote: > On 13 Jan 2011, at 6:10, Chris H wrote: > >> FWIW On a hunch, I just performed an experimentwith sed(1) >> against gsed on 50,000 html documents. My mission; to replace all instances of: >> <HTML> >> <HEAD> >> >> >> with: >> >> >> <?xml version="1.0" encoding="UTF-8"?> >> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" >> "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> >> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" dir="ltr"> >> > > > I do hope you didn't orphan a </head>-tag there? LOL Good catch! Nope. I guess my copy/paste skills aren't so good, when it comes to my mail reader. :) This is the actual script I used: fixem.sh #!/bin/sh - # WARNING - there is NO turning back! for name in $(find . -type f -name '*.html') do sed -f fixem.sed <$name >temp.txt mv temp.txt $name done rm -f temp.txt fixem.sed /\<HTML\>/d s/\<HEAD\>/\<\?xml\ version\=\"1\.0\"\ encoding\=\"UTF\-8\"\?\>\ \<\!DOCTYPE\ html\ PUBLIC\ \"\-\/\/W3C\/\/DTD\ XHTML\ 1\.0\ Strict\/\/EN\"\ \ \"http\:\/\/www\.w3\.org\/TR\/xhtml1\/DTD\/xhtml1\-strict\.dtd\"\>\ \<html\ xmlns\=\"http\:\/\/www\.w3\.org\/1999\/xhtml\"\ xml\:lang\=\"en\"\ dir\=\"ltr\"\>\ \<head\>/s --Chris > > > Alban Hertroys > > > -- > If you can't see the forest for the trees, > cut the trees and you'll see there is no forest. > > > !DSPAM:74,4d2f565011879296619823! > > > > _______________________________________________ > freebsd-stable@freebsd.org mailing list > http://lists.freebsd.org/mailman/listinfo/freebsd-stable > To unsubscribe, send any mail to "freebsd-stable-unsubscribe@freebsd.org" > > --
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?0652cc7e3380a4dd8333ff7739396560.HRCIM>