* Funny sed/reg-exp behaviour
@ 1997-03-22 6:41 David Bremer
0 siblings, 0 replies; only message in thread
From: David Bremer @ 1997-03-22 6:41 UTC (permalink / raw)
To: tru64-unix-managers
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
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~1997-03-22 6:41 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
1997-03-22 6:41 Funny sed/reg-exp behaviour David Bremer
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox