Tr

ph
이동: 둘러보기, 검색

'man tr'의 example에서 발췌

  • file1으로부터 단어를 추출하여 한줄에 단어 하나씩나오도록.

tr -cs "[:alpha:]" "\n" < file1

-c : complement -s : squeeze

  • 소문자를 대문자로

tr "[:lower:]" "[:upper:]" < file1

(보통 tr a-z A-Z 와 같이 쓰이나 모든 로케일에서 동작하도록 위의 방법을 쓸 것)

  • 프린트할 수 없는 문자 모두 지우기

tr -cd "[:print:]" < file1

-d : delete

  • diacritical mark 제거(é같은걸 모두 e로 바꾸는 그런거)

tr "[=e=]" "e"