Find the answer to your Linux question:
Results 1 to 9 of 9
Dear Experts We have 'SNOWMAN' UTF-8 character in our files which i need to replace with doublequotes ("). The UTF-8 hex value for 'SNOWMAN' is 0xE2 0x98 0x83 (e29883) , ...
  1. #1
    Just Joined!
    Join Date
    Feb 2010
    Posts
    6

    Replacing SNOWMAN with double quotes using sed

    Dear Experts

    We have 'SNOWMAN' UTF-8 character in our files which i need to replace with doublequotes (").

    The UTF-8 hex value for 'SNOWMAN' is 0xE2 0x98 0x83 (e29883) , I have written the commands like this but it is not working .........

    sed -i 's/\x0xE2 0x98 0x83/"/g' FileName

    Any help will be much appreciated

    Thanks

  2. #2
    Just Joined!
    Join Date
    Feb 2010
    Posts
    6
    Any help please..........

    Thanks

  3. #3
    Linux Guru Rubberman's Avatar
    Join Date
    Apr 2009
    Location
    I can be found either 40 miles west of Chicago, or in a galaxy far, far away.
    Posts
    8,974
    Try:
    Code:
    sed -i "s/'SNOWMAN'/\"SNOWMAN\"/g" FileName
    Sometimes, real fast is almost as good as real time.
    Just remember, Semper Gumbi - always be flexible!

  4. #4
    Just Joined!
    Join Date
    Feb 2010
    Posts
    6
    Hi

    I was still unable resolve this issue, I am not looking to replace the word SNOWMAN but the symbol snowman which is ☃ , whose unicode is 2603.

    How do I replace this symbol in a file with single quotes.

    Any help will be much appreciated .

    Thanks very much in advance

  5. #5
    Linux Guru Rubberman's Avatar
    Join Date
    Apr 2009
    Location
    I can be found either 40 miles west of Chicago, or in a galaxy far, far away.
    Posts
    8,974
    Ok. I get it now. The "snowman" symbol in unicode you want to replace with standard ascii double quotes. Correct?
    Sometimes, real fast is almost as good as real time.
    Just remember, Semper Gumbi - always be flexible!

  6. #6
    Just Joined!
    Join Date
    Feb 2010
    Posts
    6
    Yes Please.............thanks

  7. #7
    Linux Guru Rubberman's Avatar
    Join Date
    Apr 2009
    Location
    I can be found either 40 miles west of Chicago, or in a galaxy far, far away.
    Posts
    8,974
    I'm still looking into that. Are you sure about the hex value of the symbol embedded in the file(s)? Also, are the bytes in the file(s) in hex x26 and x03 in that order?
    Sometimes, real fast is almost as good as real time.
    Just remember, Semper Gumbi - always be flexible!

  8. #8
    Just Joined!
    Join Date
    Feb 2010
    Posts
    6
    Hi

    Thanks for your commitment , time and reply

    The hex value of snow man is 0xE2 0x98 0x83 , and when i see this in unix i will see some thing like 'a' with ^ and . on the top of letter ' a' ..........sorry i cann't paste exact character that i see on the linux screen.........but when i copy paste that charcter and try to replace this character it is getting replacing which is nothing but xE2 is getting replaced but the other part x98 and x83 are not getting replaced because these are non-printable charcters and when i try to delete the non printable characters it is deleting all the spaces, tabs and new line charcaters from the file...........

    Thanks

  9. #9
    Linux Guru Rubberman's Avatar
    Join Date
    Apr 2009
    Location
    I can be found either 40 miles west of Chicago, or in a galaxy far, far away.
    Posts
    8,974
    Have patience - I'm still deciding on the best way to deal with this. I'll try to respond later today or tomorrow, work permitting.
    Sometimes, real fast is almost as good as real time.
    Just remember, Semper Gumbi - always be flexible!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
...