Re: sed is broken under freebsd?

2011-01-14 Thread Chris H

On Fri, January 14, 2011 12:01 am, Chris H wrote:
>

> 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:
>>> 
>>> 
>>>
>>>
>>>
>>> with:
>>>
>>>
>>>
>>> 
>>> >> "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd";>
>>> http://www.w3.org/1999/xhtml"; xml:lang="en" dir="ltr">
>>>
>>>
>>
>>
>> I do hope you didn't orphan a -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 /\/d
> s/\/\<\?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\"\>\
> \ dir\=\"ltr\"\>\ \/s

OK I'm clearly crap when it comes to mail readers.
Before someone points this out, I'll mention it now:

the last line has a mistake

dir\=\"ltr\"\>\ \/s

should have been

dir\=\"ltr\"\>\ \/g
_^

in other words; should have ended with a "g"

'nuf said.

--Chris

>
>
>
> --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-unsubscr...@freebsd.org"
>>
>>
>>
>
>
> --
>
>
>
> ___
> freebsd-stable@freebsd.org mailing list
> http://lists.freebsd.org/mailman/listinfo/freebsd-stable
> To unsubscribe, send any mail to "freebsd-stable-unsubscr...@freebsd.org"
>
>


-- 


___
freebsd-stable@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-stable
To unsubscribe, send any mail to "freebsd-stable-unsubscr...@freebsd.org"


Re: sed is broken under freebsd?

2011-01-14 Thread Chris H

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:
>>  
>> 
>>
>>
>> with:
>>
>>
>> 
>> > "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd";>
>> http://www.w3.org/1999/xhtml"; xml:lang="en" dir="ltr">
>>
>
>
> I do hope you didn't orphan a -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
/\/d
s/\/\<\?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\"\>\
\\
\/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-unsubscr...@freebsd.org"
>
>


-- 


___
freebsd-stable@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-stable
To unsubscribe, send any mail to "freebsd-stable-unsubscr...@freebsd.org"


Re: sed is broken under freebsd?

2011-01-13 Thread Paul A. Procacci
On Thu, Jan 13, 2011 at 02:45:07PM -0500, 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:
> > 
> > 
> >
> > with:
> >
> > 
> >  > "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd";>
> > http://www.w3.org/1999/xhtml"; xml:lang="en" dir="ltr">
>
>
> I do hope you didn't orphan a -tag there?
>
> 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-unsubscr...@freebsd.org"

It was just an experiement.

~Paul

This message may contain confidential or privileged information.  If you are 
not the intended recipient, please advise us immediately and delete this 
message.  See http://www.datapipe.com/about-us-legal-email-disclaimer.htm for 
further information on confidentiality and the risks of non-secure electronic 
communication. If you cannot access these links, please notify us by reply 
message and we will send the contents to you.
___
freebsd-stable@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-stable
To unsubscribe, send any mail to "freebsd-stable-unsubscr...@freebsd.org"


Re: sed is broken under freebsd?

2011-01-13 Thread Alban Hertroys
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:
> 
> 
> 
> with:
> 
> 
>  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd";>
> http://www.w3.org/1999/xhtml"; xml:lang="en" dir="ltr">


I do hope you didn't orphan a -tag there?

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-unsubscr...@freebsd.org"


Re: sed is broken under freebsd?

2011-01-13 Thread Oliver Pinter
yeah, and the solution is was Clifton wrote, but double escaped new-line in tcsh

On 1/12/11, Peter Jeremy  wrote:
> On 2011-Jan-12 02:32:52 +0100, Oliver Pinter  wrote:
>>The freebsd versions of sed contained a bug/regression, when \n char
>>can i subsitue, gsed not affected with this bug:
>
> gsed contains non-standard extensions and you have been suckered into
> using them.  Try using 'gsed --posix' and/or setting POSIXLY_CORRECT.
> This is part of the GNU/FSF "lockin" policy that encourages people
> to use their non-standard extensions to ensure that you don't have
> any choice other than to use their software.
>
> --
> Peter Jeremy
>
___
freebsd-stable@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-stable
To unsubscribe, send any mail to "freebsd-stable-unsubscr...@freebsd.org"


Re: sed is broken under freebsd?

2011-01-12 Thread Chris H

On Wed, January 12, 2011 2:32 pm, Bob Willcox wrote:
> On Tue, Jan 11, 2011 at 09:00:09PM -1000, Clifton Royston wrote:
>
>> On Wed, Jan 12, 2011 at 02:32:52AM +0100, Oliver Pinter wrote:
>>
>>> hi all!
>>>
>>> The freebsd versions of sed contained a bug/regression, when \n char
>>> can i subsitue, gsed not affected with this bug:
>>
>>> FreeBSD xxx 8.1-RELEASE FreeBSD 8.1-RELEASE #0: Mon Jul 19 02:55:53
>>> UTC 2010 r...@almeida.cse.buffalo.edu:/usr/obj/usr/src/sys/GENERIC
>>> i386 aa@xxx ~> echo axa | sed s/x/\n/g ana aa@xxx ~> echo axa | sed 
>>> s/x/'\n'/g
>>> ana
>>
>> Different than GNU is not a bug.
>>
>>
>> I have 7.3 here.  It behaves as the above, which is how the man page says it
>> should work.  The following is how the man page specifies you can substitute 
>> a
>> newline, by prefacing a quoted actual newline with a backslash:
>>
>> $ echo axa | sed 's/x/\
>>
>>> /g'
>>>
>> a a
>>
>> That's how I remember classic sed behaving (Unix v7 or thereabouts.)
>> -- Clifton
>>
>
> FWI, AIX 6.1 sed works as the FreeBSD sed does.

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:



with:


http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd";>
http://www.w3.org/1999/xhtml"; xml:lang="en" dir="ltr">

in an effort to see how long it would take to perform the operation for
each of the two versions.

The results?

sed(1) (as provided by the BSD family of operating systems):
~2 seconds

gsed:
~4.5 seconds

Apologies for the extra noise on the list, but I do a tremendous amount
of editing with sed(1) on almost a daily basis. It's a _fantastic_
tool, that saves me _zillions_ of hours. So I'm afraid I become a bit
defensive when hearing anyone defame it - it's been like a trusted
friend to me. :)

--Chris

>
>
> --
> Bob Willcox  When the ax entered the forest, the trees said,
> b...@immure.com   "The handle is one of us!" Austin, TX
> -- Turkish proverb
> ___
> freebsd-stable@freebsd.org mailing list
> http://lists.freebsd.org/mailman/listinfo/freebsd-stable
> To unsubscribe, send any mail to "freebsd-stable-unsubscr...@freebsd.org"
>
>


-- 


___
freebsd-stable@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-stable
To unsubscribe, send any mail to "freebsd-stable-unsubscr...@freebsd.org"


Re: sed is broken under freebsd?

2011-01-12 Thread Mark Saad
On Wed, Jan 12, 2011 at 5:32 PM, Bob Willcox  wrote:
> On Tue, Jan 11, 2011 at 09:00:09PM -1000, Clifton Royston wrote:
>> On Wed, Jan 12, 2011 at 02:32:52AM +0100, Oliver Pinter wrote:
>> > hi all!
>> >
>> > The freebsd versions of sed contained a bug/regression, when \n char
>> > can i subsitue, gsed not affected with this bug:
>>
>> > FreeBSD xxx 8.1-RELEASE FreeBSD 8.1-RELEASE #0: Mon Jul 19 02:55:53
>> > UTC 2010     r...@almeida.cse.buffalo.edu:/usr/obj/usr/src/sys/GENERIC
>> >  i386
>> > a...@xxx ~> echo axa | sed s/x/\n/g
>> > ana
>> > a...@xxx ~> echo axa | sed s/x/'\n'/g
>> > ana
>>
>> Different than GNU is not a bug.
>>
>> I have 7.3 here.  It behaves as the above, which is how the man page says it
>> should work.  The following is how the man page specifies you can substitute
>> a newline, by prefacing a quoted actual newline with a backslash:
>>
>> $ echo axa | sed 's/x/\
>> > /g'
>> a
>> a
>>
>>   That's how I remember classic sed behaving (Unix v7 or thereabouts.)
>>   -- Clifton
>
> FWI, AIX 6.1 sed works as the FreeBSD sed does.


 Solaris 2.6 and OSX 10.6 , do the same thing as FreeBSD as well.



-- 

mark saad | nones...@longcount.org
___
freebsd-stable@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-stable
To unsubscribe, send any mail to "freebsd-stable-unsubscr...@freebsd.org"


Re: sed is broken under freebsd?

2011-01-12 Thread Bob Willcox
On Tue, Jan 11, 2011 at 09:00:09PM -1000, Clifton Royston wrote:
> On Wed, Jan 12, 2011 at 02:32:52AM +0100, Oliver Pinter wrote:
> > hi all!
> > 
> > The freebsd versions of sed contained a bug/regression, when \n char
> > can i subsitue, gsed not affected with this bug:
>  
> > FreeBSD xxx 8.1-RELEASE FreeBSD 8.1-RELEASE #0: Mon Jul 19 02:55:53
> > UTC 2010 r...@almeida.cse.buffalo.edu:/usr/obj/usr/src/sys/GENERIC
> >  i386
> > a...@xxx ~> echo axa | sed s/x/\n/g
> > ana
> > a...@xxx ~> echo axa | sed s/x/'\n'/g
> > ana
> 
> Different than GNU is not a bug.
> 
> I have 7.3 here.  It behaves as the above, which is how the man page says it
> should work.  The following is how the man page specifies you can substitute
> a newline, by prefacing a quoted actual newline with a backslash:
> 
> $ echo axa | sed 's/x/\
> > /g'
> a
> a
> 
>   That's how I remember classic sed behaving (Unix v7 or thereabouts.)
>   -- Clifton

FWI, AIX 6.1 sed works as the FreeBSD sed does.

-- 
Bob Willcox  When the ax entered the forest, the trees said,
b...@immure.com   "The handle is one of us!"
Austin, TX  -- Turkish proverb
___
freebsd-stable@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-stable
To unsubscribe, send any mail to "freebsd-stable-unsubscr...@freebsd.org"


Re: sed is broken under freebsd?

2011-01-12 Thread Peter Jeremy
On 2011-Jan-12 02:32:52 +0100, Oliver Pinter  wrote:
>The freebsd versions of sed contained a bug/regression, when \n char
>can i subsitue, gsed not affected with this bug:

gsed contains non-standard extensions and you have been suckered into
using them.  Try using 'gsed --posix' and/or setting POSIXLY_CORRECT.
This is part of the GNU/FSF "lockin" policy that encourages people
to use their non-standard extensions to ensure that you don't have
any choice other than to use their software.

-- 
Peter Jeremy


pgpd7zj0Dn2kG.pgp
Description: PGP signature


Re: sed is broken under freebsd?

2011-01-11 Thread Clifton Royston
On Wed, Jan 12, 2011 at 02:32:52AM +0100, Oliver Pinter wrote:
> hi all!
> 
> The freebsd versions of sed contained a bug/regression, when \n char
> can i subsitue, gsed not affected with this bug:
 
> FreeBSD xxx 8.1-RELEASE FreeBSD 8.1-RELEASE #0: Mon Jul 19 02:55:53
> UTC 2010 r...@almeida.cse.buffalo.edu:/usr/obj/usr/src/sys/GENERIC
>  i386
> a...@xxx ~> echo axa | sed s/x/\n/g
> ana
> a...@xxx ~> echo axa | sed s/x/'\n'/g
> ana

Different than GNU is not a bug.

I have 7.3 here.  It behaves as the above, which is how the man page says it
should work.  The following is how the man page specifies you can substitute
a newline, by prefacing a quoted actual newline with a backslash:

$ echo axa | sed 's/x/\
> /g'
a
a

  That's how I remember classic sed behaving (Unix v7 or thereabouts.)
  -- Clifton

-- 
Clifton Royston  --  clift...@iandicomputing.com / clift...@lava.net
   President  - I and I Computing * http://www.iandicomputing.com/
 Custom programming, network design, systems and network consulting services
___
freebsd-stable@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-stable
To unsubscribe, send any mail to "freebsd-stable-unsubscr...@freebsd.org"


sed is broken under freebsd?

2011-01-11 Thread Oliver Pinter
hi all!

The freebsd versions of sed contained a bug/regression, when \n char
can i subsitue, gsed not affected with this bug:

FreeBSD xxx 8.1-RELEASE FreeBSD 8.1-RELEASE #0: Mon Jul 19 02:55:53
UTC 2010 r...@almeida.cse.buffalo.edu:/usr/obj/usr/src/sys/GENERIC
 i386
a...@xxx ~> echo axa | sed s/x/\n/g
ana
a...@xxx ~> echo axa | sed s/x/'\n'/g
ana
it is FreeBSD 8.1 base systems sed

a...@centaur:~$ uname -a
Linux centaur 2.6.18-6-686 #1 SMP Thu Aug 20 21:56:59 UTC 2009 i686 GNU/Linux
a...@centaur:~$ echo axa | sed s/x/\n/g
ana
a...@centaur:~$ echo axa | sed s/x/'\n'/g
a
a
a...@centaur:~$ sed --version
GNU sed verzió 4.1.5



ural2:~$ uname -a
SunOS ural2 5.8 Generic_117350-62 sun4u sparc
ural2:~$ echo axa | sed s/x/\n/g
ana
ural2:~$ echo axa | sed s/x/'\n'/g
a
a
ural2:~$ sed --version
GNU sed version 4.2.1
___
freebsd-stable@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-stable
To unsubscribe, send any mail to "freebsd-stable-unsubscr...@freebsd.org"