Home Man
Search
Today's Posts
Register


How to replace special characters?

UNIX for Advanced & Expert Users




Kindly Note - This is a Single User Post by Forum Member MadeInGermany Regarding:
How to replace special characters?.
Please Follow The Primary Link Above to View the Full Discussion.

Old 04-22-2017
Post#4 requires the match at the beginning of the string.
Post#2 does only one substitution and also does it for A.B.
The following requires a digit after the dot, and because it is part of the match must mark it in \( \) and put it back via a back-reference. Also it does the substitution globally.
Code:
echo '|*|.5|*|0.2|*|A.B|*|' | sed 's/|\(\.[0-9]\)/|0\1/g'

 


All times are GMT -4. The time now is 01:02 PM.
Unix & Linux Forums Content Copyrightę1993-2018. All Rights Reserved.