tru64-unix-managers (formerly alpha-osf-managers) (1994-2012)
 help / color / mirror / Atom feed
* SUMMARY: How to substitute with sed
@ 2001-03-14 16:24 Rost, Werner
  0 siblings, 0 replies; only message in thread
From: Rost, Werner @ 2001-03-14 16:24 UTC (permalink / raw)
  To: tru64-unix-managers

Hello all,

this list is great!!! Thanks to all who answered - there were many (!!)
answers in a short time.


Solution:  echo "$text"   instead of    echo $text


Another short demo:

Switch1> x='A   B'
Switch1> echo $x
A B
Switch1> echo "$x"
A   B


regards

Werner Rost


------------------------------------------------------------------------

Hello gurus,

I guess this is a trivial question for all of you - except me .:)

In a test string I want to substitute the character "x" by blanks:

#!/usr/bin/ksh
#
text="P1A2 127558xxxxxxMMJJ1x750xxxxxxxxxx000x 024"
echo $text
text=`echo $text | /usr/bin/sed 's/x/ /g'`
echo $text

This leads to:

P1A2 127558xxxxxxMMJJ1x750xxxxxxxxxx000x 024
P1A2 127558 MMJJ1 750 000 024

Unfortunatly I miss many blanks. Output should read:

P1A2 127558xxxxxxMMJJ1x750xxxxxxxxxx000x 024
P1A2 127558      MMJJ1 750          000  024

What is going wrong?

regards
Werner Rost
--------------------------------------------------
Werner Rost, Mannesmann-Boge GmbH
Abt:    KIR
Tel:    0228/3825-420
Fax:    0228/3825-398
Email:  werner.rost@boge.mannesmann.de
Friesdorfer Str. 175, 53175 Bonn - Bad Godesberg
---------------------------------------------------



-----------------------------------------------------------
This Mail has been checked for Viruses
Attention: Encrypted Mails can NOT be checked !

***

Diese Mail wurde auf Viren ueberprueft
Hinweis: Verschluesselte Mails koennen NICHT geprueft werden!
------------------------------------------------------------

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2001-03-14 16:24 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2001-03-14 16:24 SUMMARY: How to substitute with sed Rost, Werner

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