PHWinfo banniere

Titres
PORTAIL ANNUAIRE ARTICLES COMPARATEUR HÉBERGEURS DEVIS FORUMS RÉDUCTEUR D'URL
Précédent   PHWinfo > Forums Hébergement > Forum Serveur - Sécurité et techniques > comp.unix.shell > different sed behaviour on mac os x and linux
S'inscrire FAQ Membres Recherche Messages du jour Marquer les forums comme lus
comp.unix.shell Using and programming the Unix shell.

different sed behaviour on mac os x and linux

Réponse
 
LinkBack Outils de la discussion
Vieux 10/11/2007, 14h19   #1
MNiegl
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut different sed behaviour on mac os x and linux

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

  Réponse avec citation
Vieux 10/11/2007, 14h34   #2
Cyrus Kriticos
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: different sed behaviour on mac os x and linux

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.
  Réponse avec citation
Vieux 11/11/2007, 13h56   #3
MNiegl
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: different sed behaviour on mac os x and linux

On Nov 10, 3:34 pm, Cyrus Kriticos <cyrus.kriti...@googlemail.com>
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

  Réponse avec citation
Réponse


Outils de la discussion

Règles de messages
Vous ne pouvez pas créer de nouvelles discussions
Vous ne pouvez pas envoyer des réponses
Vous ne pouvez pas envoyer des pièces jointes
Vous ne pouvez pas modifier vos messages

Les balises BB sont activées : oui
Les smileys sont activés : oui
La balise [IMG] est activée : oui
Le code HTML peut être employé : non
Trackbacks are oui
Pingbacks are oui
Refbacks are oui


Fuseau horaire GMT +1. Il est actuellement 09h17.


Édité par : vBulletin® version 3.7.2
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0 RC5 Tous droits réservés.
Version française #16 par l'association vBulletin francophone
PHWinfo est un site Éducation Sans Frontières
Ad Management by RedTyger
©Tous droits réservés par les parties respectives
Page generated in 0,09850 seconds with 11 queries