remove special characters awk && iconv


#remove special char !!!!!NOTE YOU NEED GAWK!!!MAWK WILL NOT WORK

echo "[]# ¹²³asdfa é sd123" | awk '{gsub(/ +/,"_");gsub(/[^[:alnum:]_]/,"");print}'

#remove special characters removing even words like éè etc

echo "[]# ¹²³asdfa é sd123" |LC_ALL=C  awk '{gsub(/ +/,"_");gsub(/[^[:alnum:]_]/,"");print}'

#samething but with iconv

echo "[]# ¹²³asdfa é ▶ Che tempo che fa - Giovanni Storti  " | iconv -t EBCDIC-IT//IGNORE 2>/dev/null | iconv -f  EBCDIC-IT 

thank to enzotib and geirha from awk channel

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: