tru64-unix-managers (formerly alpha-osf-managers) (1994-2012)
 help / color / mirror / Atom feed
From: David Bremer <DaveB () healthotago ! co ! nz>
To: tru64-unix-managers
Subject: Funny sed/reg-exp behaviour
Date: Sat, 22 Mar 1997 06:41:45 +0000	[thread overview]
Message-ID: <96078609810572.tru64-unix-managers.marc@archive.invalid> (raw)

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

                 reply	other threads:[~1997-03-22  6:41 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed
read-only archive

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox