Q: How to substitute with sed

From: Rost, Werner <Werner.Rost_at_boge.mannesmann.de>
Date: Wed, 14 Mar 2001 16:58:18 +0100

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_at_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!
------------------------------------------------------------
Received on Wed Mar 14 2001 - 16:03:26 NZDT

This archive was generated by hypermail 2.4.0 : Wed Nov 08 2023 - 11:53:41 NZDT