Using sed as follows is expected to produce a newline where the first "x" is. However, under a Win machine it doesn't do this, can anyone see why - other than trying to run a *NIX utility under Windows? I'm not at my SUSE box, so can't play with it there. sed s/x/\\n/ Thanks much, Don -- Web Developer Matheteuo Christian Fellowship webdev@matheteuo.org http://matheteuo.org/ Running MS Windows + Office = $400 Running Linux + OpenOffice.org = $0 Celebrating as you delete your format your Windows drive = PRICELESS
On Wednesday 16 June 2004 01:58, Web Developer wrote:
Using sed as follows is expected to produce a newline where the first "x" is. However, under a Win machine it doesn't do this, can anyone see why - other than trying to run a *NIX utility under Windows? I'm not at my SUSE box, so can't play with it there.
sed s/x/\\n/
On Linus, the newline sequence is: 0xA or \n. On Windoes, the newline sequence is: 0xD 0xA, or \r\n. On Macintosh, the newline sequence is: 0xD, or \r. You can use dos2unix or unix2dos to convert between these two. I'm not sure, but perhaps there's also mac2unix and unix2mac. Cheers, Leen
Leendert Meyer wrote:
On Wednesday 16 June 2004 01:58, Web Developer wrote:
Using sed as follows is expected to produce a newline where the first "x" is. However, under a Win machine it doesn't do this, can anyone see why - other than trying to run a *NIX utility under Windows? I'm not at my SUSE box, so can't play with it there.
sed s/x/\\n/
On Linus, the newline sequence is: 0xA or \n. On Windoes, the newline sequence is: 0xD 0xA, or \r\n. On Macintosh, the newline sequence is: 0xD, or \r.
You can use dos2unix or unix2dos to convert between these two. I'm not sure, but perhaps there's also mac2unix and unix2mac.
Cheers,
Leen
That still didn't produce the desired results for some reason. Never mind, though. My friend found a work-around that does what he needs. It did work using Knoppix, so it shouldn't be an issue for me and my SUSE box. Thanks for the quick response. Don -- Don Parris Webmaster Matheteuo Christian Fellowship Charlotte, NC http://matheteuo.org/ webdev@matheteuo.org
Don Parris
Leendert Meyer wrote:
On Wednesday 16 June 2004 01:58, Web Developer wrote:
Using sed as follows is expected to produce a newline where the first "x" is. However, under a Win machine it doesn't do this, can anyone see why - other than trying to run a *NIX utility under Windows? I'm not at my SUSE box, so can't play with it there.
sed s/x/\\n/
On Linus, the newline sequence is: 0xA or \n. On Windoes, the newline sequence is: 0xD 0xA, or \r\n. On Macintosh, the newline sequence is: 0xD, or \r.
That still didn't produce the desired results for some reason.
IMHO the XPG4 sed doesn't accept '\n' in the replacement section. (The GNU sed does.) A workaround is to use e.g. $ echo abcxdef | sed -e 's/x/\
/' abc def
The corresponding MS-Windows utility may have similar limitations. -- A.M.
participants (4)
-
Alexandr Malusek
-
Don Parris
-
Leendert Meyer
-
Web Developer