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.