sed remove all occurrences in a string
I have:
Code:
C:\u002Cdata\u002CDocuments Code:
sed 's/u0052//' Thanks & Regards |
Tack a g at the end of the expression
Code:
sed 's/u002C//g' Cheers, Tink |
Thanks.
Just a bit more on what I am doing. From the command line it works fine: Code:
[me@host scripts]$ FOLDER=$(echo "C:\u002Cdata\u002CMy Files" | sed 's/C:\\/\//' | sed 's/u005C//g' | tr '\' '/' | sed 's/ /\\ /') Code:
FPATH="C:\u002Cdata\u002CMy Files" Thanks & Regards |
And what is the error it errors out with?
|
It came with
Code:
sed: -e expression #1, char 11: unknown option to `s' Code:
FPATH="C:\u002Cdata\u002CMy Files" Code:
C:/data/My: Code:
/data/My\ Files Code:
FPATH="C:\u002Cdata\u002CMy Files" Thanks & Regards |
May I also suggest that when dealing with the slash (/) that you use an alternate symbol for search and replace in sed to make it clearer.
eg Code:
FOLDER=$(echo "$FPATH" | sed 's@C:\\@/@') Code:
FOLDER=$(echo "$FPATH" | sed -r -e 's@(C:|u002C)@@g' -e 's@\\@/@g' |
All times are GMT -5. The time now is 12:17 PM. |