1

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.

uetoyo
  • 329
  • 1
  • 3
  • 11

1 Answers1

1

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'
Zombo
  • 1
  • 62
  • 391
  • 407
  • `$ tr -c '[:cntrl:][:print:]' '\n' < input.txt > output.txt` `tr: when translating with complemented character classes, string2 must map all characters in the domain to one` This is the input: Bývalý technik amerických tajných služeb Edward Snowden rozšířil svou žádost o azyl na dvacítku dalších zemí. – uetoyo May 06 '14 at 08:57
  • Yes, it works, I have some other problems, but this helped me a lot. – uetoyo May 06 '14 at 11:33