Results 1 to 2 of 2
I have to replace longer strings with shorter strings,
ex. replacing abcdefg, defgh with xyz
How can I replace strings while retaining/preserving the number of spaces
after the sting?
Because ...
- 09-28-2007 #1Just Joined!
- Join Date
- Sep 2007
- Posts
- 1
Replacing strings
I have to replace longer strings with shorter strings,
ex. replacing abcdefg, defgh with xyz
How can I replace strings while retaining/preserving the number of spaces
after the sting?
Because I need to preserve the formating between columns.
ex. abcdefg 123 -> xyz ---123 (here - denotes spaces to preserve)
not abcdefg 123 -> xyz 123
I have tried using sed 's/'"$old_string"'/'"$new_string"'/g'
but the output is grabbed.
TIA,
Mongster
- 09-28-2007 #2Just Joined!
- Join Date
- Jul 2007
- Posts
- 41
Does this work?
What's the output you're getting?Code:sed 's/abcdefg/xyz /g'


Reply With Quote