|
|
|
|
||||||
| comp.unix.shell Using and programming the Unix shell. |
![]() |
|
|
LinkBack | Outils de la discussion |
|
|
#1 |
|
Messages: n/a
Hébergeur: |
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 |
|
|
|
#2 |
|
Messages: n/a
Hébergeur: |
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. |
|
|
|
#3 |
|
Messages: n/a
Hébergeur: |
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 |
|
![]() |
| Outils de la discussion | |
|
|