Archive for December, 2008

Removing £ signs from a file using sed

Tuesday, December 2nd, 2008

Hi

If you’ve ever tried to use ’sed’ to remove the UK pound sign (£) from a file you may have struggled.  We were bashing our head against the wall until we tried this little trick :

 sed -e 's/'`echo -e "\xA3"`'//g' input.txt > output.txt

Note the important difference between the single-quote and the ‘back-tick’ around the echo.

We had been trying to use the pound sign directly in the terminal window but it just wasn’t matching for some reason.  We then used a Hex Editor  to find the raw code that was being used to represent the pound sign in the file and used that instead and voila!, it works.