Frage

I use a Unix utility tr via Cygwin. I want to replace the non-alphabetical characters for '\ n', but tr also recognize accented characters as non-alphabetic (ěščřžýáíé -> \ n). Can I change this setting?

Thanks.

War es hilfreich?

Lösung

This should do it

tr -c '[:cntrl:][:print:]' '\n'

Depending on locale you might need to

LANG= tr -c '[:cntrl:][:print:]' '\n'

Or this

tr -c $'\x01-\x7e' '\n'
Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top