[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Sed bug ?
From: |
Patrick Gaughan |
Subject: |
Sed bug ? |
Date: |
Tue, 13 Dec 2005 01:40:41 +0000 |
User-agent: |
Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7.8) Gecko/20050511 |
Hi
I recently downloaded the Win32 port of the UnxUtils hoping to be able
to use Sed on my
Windows XP system in a DOS box. The first thing I tried was the EOLN
conversion, so
that I could read the docs I had also downloaded. Most of these of
course only have LF as
an EOLN as per Unix and are difficult to read.. A good "Hello World"
type try-out for my new
utility I thought. Using the conversion examples from the Sed FAQ; i.e.
# Under DOS: convert Unix newlines (LF) to DOS format
sed 's/$//' file # method 1
sed -n p file # method 2
was not successful so I read the FAQ several times to try and come up
with an
explanation. Having found nothing in there, but at least becoming
familiar with the new
concept (to me) of regular expressions I came up with
sed "s/.*/&\r/"
which did work. I then tried the 'sed -n p' example again on the
converted text and this
stripped out the CRs that I had inserted. So that, I presume, is why the
examples did not work,
Sed is not inserting CRLF as EOLN, only LF. Assuming that I am not
missing something relevant in
the FAQ and the other help pages I have now read, I presume this is not
the intended behaviour
for a Win32 port. It will be a real pain if it strips out the CRs from
every document I try to edit.
Please forgive me if this is some stupid mistake on my part as a newbie
to Sed.
Patrick Gaughan
- Sed bug ?,
Patrick Gaughan <=