different sed behaviour on mac os x and linux

different sed behaviour on mac os x and linux

am 10.11.2007 15:19:27 von MNiegl

Hello everyone,
I have a very strange problem using sed. I'm trying to parse a normal
text file and one of the things i want to do is remove all lines that
contain an arrow (looking like that ->). So I do
sed -e '/\-\>/ d' infile > outfile
which works perfectly fine on my Mac running Mac OS X 10.4.10 but
doesn't do anything under Linux (tried it with both openSuse 10.2 and
Scientific Linux SLC 4.4). On the linux machines it's GNU sed v4.1.2.
I also tried substituting the arrow, which again didn't do anything,
so quite obviously the pattern is not found. Is this due to some
discrepancy between the linux and the BSD versions of sed, or some
special character differences that I'm not aware of?
And does anyone have a suggestion how else to achieve the deletion of
the lines under Linux?

Thanks & Cheers,
Michael

Re: different sed behaviour on mac os x and linux

am 10.11.2007 15:34:19 von Cyrus Kriticos

MNiegl wrote:
> Hello everyone,
> I have a very strange problem using sed. I'm trying to parse a normal
> text file and one of the things i want to do is remove all lines that
> contain an arrow (looking like that ->). So I do
> sed -e '/\-\>/ d' infile > outfile
> which works perfectly fine on my Mac running Mac OS X 10.4.10 but
> doesn't do anything under Linux (tried it with both openSuse 10.2 and
> Scientific Linux SLC 4.4). On the linux machines it's GNU sed v4.1.2.
> I also tried substituting the arrow, which again didn't do anything,
> so quite obviously the pattern is not found. Is this due to some
> discrepancy between the linux and the BSD versions of sed, or some
> special character differences that I'm not aware of?
> And does anyone have a suggestion how else to achieve the deletion of
> the lines under Linux?

remove both \

--
Best regards | Be nice to America or they'll bring democracy to
Cyrus | your country.

Re: different sed behaviour on mac os x and linux

am 11.11.2007 14:56:37 von MNiegl

On Nov 10, 3:34 pm, Cyrus Kriticos
wrote:
> MNiegl wrote:
> > Hello everyone,
> > I have a very strange problem using sed. I'm trying to parse a normal
> > text file and one of the things i want to do is remove all lines that
> > contain an arrow (looking like that ->). So I do
> > sed -e '/\-\>/ d' infile > outfile
> > which works perfectly fine on my Mac running Mac OS X 10.4.10 but
> > doesn't do anything under Linux (tried it with both openSuse 10.2 and
> > Scientific Linux SLC 4.4). On the linux machines it's GNU sed v4.1.2.
> > I also tried substituting the arrow, which again didn't do anything,
> > so quite obviously the pattern is not found. Is this due to some
> > discrepancy between the linux and the BSD versions of sed, or some
> > special character differences that I'm not aware of?
> > And does anyone have a suggestion how else to achieve the deletion of
> > the lines under Linux?
>
> remove both \

thanks, that did the trick.

Cheers,
Michael