Results 1 to 7 of 7
Hi forum,
i have a small sed script witch strips all special chars from stdin
sed -e "s/[^Aa0-Zz9]/_/g"
My enviroment var LANG is pt_PT.UTF-8 and when i try to strip ...
- 07-03-2007 #1Just Joined!
- Join Date
- Jul 2007
- Posts
- 4
sed strict pattern
Hi forum,
i have a small sed script witch strips all special chars from stdin
sed -e "s/[^Aa0-Zz9]/_/g"
My enviroment var LANG is pt_PT.UTF-8 and when i try to strip something like this
echo "Página de teste" | sed -e "s/[^Aa0-Zz9]/_/g"
it outputs 'Página_de_teste' instead of 'P_gina_de_teste' or even better 'Pagina_de_teste'
some help please...
- 07-03-2007 #2Linux User
- Join Date
- Jun 2007
- Posts
- 318
Did you '# export LANG' after setting it?
- 07-03-2007 #3Just Joined!
- Join Date
- Jul 2007
- Posts
- 4
Thats my native lang, i've installed the box (CentOS 4.5) with this lang, and i want to keep it.
The thing is sed thinks that 'á' is included in my search pattern and that's not good.
I just want sed to distinguish one from another.
- 07-03-2007 #4Linux Enthusiast
- Join Date
- Aug 2006
- Posts
- 631
Try:
RegardsCode:echo "Página de teste" | sed 's/[^A-Z ^a-z ^0-9]/_/g'
- 07-03-2007 #5Just Joined!
- Join Date
- Jul 2007
- Posts
- 4
- 07-03-2007 #6Linux Enthusiast
- Join Date
- Aug 2006
- Posts
- 631
You can try something like:
RegardsCode:echo "Página de teste" | sed 's/[^A-Z^a-z^0-9]/_/g' | sed 's/á/a/g'
- 07-03-2007 #7Just Joined!
- Join Date
- Jul 2007
- Posts
- 4
Cool thats it
it worked fine
just one tiny little problem
i've got to predict all portuguese special chars, and they're quite a bit,
but i can live with that
Thanks


Reply With Quote
