It turns out that you are right on. The trouble is the file has carriage return,
line feed termination (ie. DOS mode). vi doesn't show the ^M (at least not with the
settings that I am using). We were able to take care of the problem, by using tr to strip
out the carriage returns.
-----Original Message-----
From: Cameron Simpson [mailto:cs@xxxxxxxxxx]
Sent: Thursday, October 30, 2003 6:52 PM
To: redhat-list@xxxxxxxxxx
Subject: Re: sed - trouble matching end of line
On 16:17 30 Oct 2003, Kunkel, Mark <mckunkel@xxxxxxxxxxx> wrote:
| We are attempting to use sed to remove blank lines from a stream with:
|
| sed '/^[ ]*$/d'
|
| where the brackets contain a space and a tab. This works with cygwin, but
| not on RedHat 8.
|
| Both systems report the sed version as 3.02
|
| I have two questions.
|
| 1.) Does anyone know that this has been corrected in a newer version of sed?
I doubt it's a sed bug. (It has them, but not something this basic).
| 2.) Does anyone know of another way to match end of line with sed?
You're doing it right.
Check:
that you really have a space and a tab in there, rather than
some cut/paste accident with a bunch of spaces and no tab
that the data file is a nice clean UNIX file - no DOS line endings
in it. The latter will show as ^M at the end of the line in vi.
"od -c" will also make this obvious.
How did the data file get to your UNIX box?
Maybe you need to dos2unix the data file.
Cheers,
--
Cameron Simpson <cs@xxxxxxxxxx> DoD#743
http://www.cskk.ezoshosting.com/cs/
Here's a great .sig I wrote, so good it doesn't rhyme.
Jon Benger <jbenger@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx>
--
redhat-list mailing list
unsubscribe mailto:redhat-list-request@xxxxxxxxxx?subject=unsubscribe
https://www.redhat.com/mailman/listinfo/redhat-list