Tr

ph
175.193.109.55 (토론)님의 2011년 6월 6일 (월) 16:25 판 (새 문서: 'man tr'의 example에서 발췌 * file1으로부터 단어를 추출하여 한줄에 단어 하나씩나오도록. <blockquote> tr -cs "[:alpha:]" "\n" < file1 </blockquote> -c : comple...)
(차이) ← 이전 판 | 최신판 (차이) | 다음 판 → (차이)
이동: 둘러보기, 검색

'man tr'의 example에서 발췌

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

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

-c : complent -s : squeeze

  • 소문자를 대문자로

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

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

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

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

-d : delete

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

tr "[=e=]" "e"