From mboxrd@z Thu Jan 1 00:00:00 1970 Message-ID: <96078609810572.tru64-unix-managers.marc@archive.invalid> From: David Bremer Date: Sat, 22 Mar 1997 06:41:45 +0000 To: tru64-unix-managers Subject: Funny sed/reg-exp behaviour X-MARC-Message: https://marc.info/?l=tru64-unix-managers&m=96078609810572 I've just been trying to do a simple substitution on a character in a file to be a new line marker "\n" (the character to change was char(253) - but this happened on attempting anything - e.g. "~!") I had thought that a simple command like $sed 's/~!/\\n/g' filename Would do it. But I couldn't get the backslash in. I thought that to substitute in a backslash you simply needed to escape it with another backslash - but it never worked - all I ended up with was "IN-CAPITALS-TO-SHOW-EFFECT~!BANANA" being changed to "IN-CAPITALS-TO-SHOW-EFFECTnBANANA" (i.e. a "n" was substituted instead of "\n" Eventually I found that FOUR backslashes worked $sed 's/~!/\\\\n/g' filename "IN-CAPITALS-TO-SHOW-EFFECT\nBANANA" Is this normal? A strange DU implimentation of sed (not likely)? or a subtle part of escaping that I've missed (most probably)? TIA for any enlightenment Dave -- Clinical Account Manager, Information Systems Healthcare Otago (Dunedin NZ) Ph internal: NB CHANGE 8830 email: daveb@healthotago.co.nz Pretentious quote of the week/month (whatever): "The main things to expect when dealing with printers are troubles and frustrations. If all else fails, just be glad its not MS-DOS". The Red Sys-Admin Book