How can I convert a string like Žvaigždės aukštybėj užges or äüöÖÜÄ to Zvaigzdes aukstybej uzges or auoOUA, respectively, using Bash?
Basically I just want to convert all characters which aren't in the Latin alphabet.
Thanks
Depending on your machine you can try piping your strings through
iconv -f utf-8 -t ascii//translit
(or whatever your encoding is, if it's not utf-8)
echo "Aldo Vásquez" | tr 'ÁáÉé' 'AaEe', but it's hardly a solution to write home about… try {
String name = "Žvaigždės aukštybėj užges ";
String s1 = Normalizer.normalize(name, Normalizer.Form.NFKD);
String regex = "[\\p{InCombiningDiacriticalMarks}\\p{IsLm}\\p{IsSk}]+";
String s2 = new String(s1.replaceAll(regex, "").getBytes("ascii"), "ascii");
} catch (UnsupportedEncodingException e) {
}