Rechercher une page de manuel
tr
Langue: ja
Version: 7 October 2002 (openSuse - 09/10/07)
Section: 1 (Commandes utilisateur)
Sommaire
̾Á°
tr - ʸ»ú¤ÎÊÑ´¹¡¦ºï½ü¤ä¡¢Ï¢Â³¤¹¤ëʸ»ú¤Î°µ½Ì¤ò¹Ô¤¦½ñ¼°
tr [-cdst ] [--complement] [--delete] [--squeeze-repeats] [--truncate-set1] SET1 [SET2]tr [--help] [--version]
ÀâÌÀ
tr ¤Ïɸ½àÆþÎϤòɸ½à½ÐÎϤ˥³¥Ô¡¼¤·¡¢¤½¤ÎºÝ¤Ë°Ê²¼¤Î¤¦¤Á¤Î¤¤¤º¤ì¤«¤ò¹Ô¤¦¡£- *
- ʸ»ú¤òÊÑ´¹¤·¡¢¥ª¥×¥·¥ç¥ó¤Ç»ØÄꤹ¤ì¤Ð¤µ¤é¤ËϢ³¤¹¤ëʸ»ú¤ò°µ½Ì (squeeze) ¤¹¤ë¡£
- *
- Ϣ³¤¹¤ëʸ»ú¤ò°µ½Ì¤¹¤ë¡£
- *
- ʸ»ú¤òºï½ü¤¹¤ë¡£
- *
- ʸ»ú¤òºï½ü¤·¤Æ¤«¤é¡¢Ï¢Â³¤¹¤ëʸ»ú¤ò°µ½Ì¤¹¤ë¡£
SET1 ¤ª¤è¤Ó (Í¿¤¨¤é¤ì¤Æ¤¤¤ì¤Ð) SET2 °ú¤¿ô¤Ï¡¢ ʸ»ú¤Î½ç½øÉÕ¤¥»¥Ã¥È¤òÄêµÁ¤¹¤ë¡£ ¤³¤ì¤é¤Îʸ»ú¥»¥Ã¥È¤¬ÆþÎϤ˸ºß¤¹¤ë¤È¡¢ tr ¤Ï¤½¤Îʸ»ú¤ËÂФ·¤ÆÆ°ºî¤ò¹Ô¤¦¡£
¥ª¥×¥·¥ç¥ó
- -c, --complement
- SET1 ¤ò¡¢ SET1 ¼«¿È¤ÎÊ佸¹ç (SET1 ¤Ë´Þ¤Þ¤ì¤Ê¤¤Ê¸»ú¤¹¤Ù¤Æ) ¤ÇÃÖ¤´¹¤¨¤ë¡£
- -d, --delete
- SET1 ¤Ë¤¢¤ëÆþÎÏʸ»ú¤òºï½ü¤¹¤ë¡£ÊÑ´¹¤·¤Ê¤¤¡£
- -s, --squeeze-repeats
- Ʊ¤¸Ê¸»ú¤Î·«¤êÊÖ¤·¤ò 1 ʸ»ú¤ËÃÖ¤´¹¤¨¤ë¡£ ¤³¤ÎÁàºî¤ÏÊÑ´¹¤äºï½ü¤Î¤¢¤È¤Ë¹Ô¤ï¤ì¤ë¡£ SET1 ¤Ë¤¢¤ëʸ»ú¤Î·«¤êÊÖ¤·¤ò¡¢¤½¤Îʸ»ú 1 ʸ»ú¤ËÃÖ¤´¹¤¨¤ë¡£
- -t, --truncate-set1
- ÊÑ´¹¤ò¹Ô¤¦Á°¤Ë¡¢¤Þ¤º SET1 ¤ò SET2 ¤ÎŤµ¤ËÀÚ¤êµÍ¤á¤ë¡£
- --help
- ɸ½à½ÐÎϤ˻ÈÍÑÊýË¡¤Î¥á¥Ã¥»¡¼¥¸¤ò½ÐÎϤ·¤ÆÀµ¾ï½ªÎ»¤¹¤ë¡£
- --version
- ɸ½à½ÐÎϤ˥С¼¥¸¥ç¥ó¾ðÊó¤ò½ÐÎϤ·¤ÆÀµ¾ï½ªÎ»¤¹¤ë¡£
ʸ»ú¥»¥Ã¥È¤Î»ØÄê
SET1 ¤ª¤è¤Ó SET2 °ú¤¿ô¤Î¥Õ¥©¡¼¥Þ¥Ã¥È¤Ï Àµµ¬É½¸½¤È»÷¤¿¤â¤Î¤Ë¤Ê¤Ã¤Æ¤¤¤ë¡£¤·¤«¤·Àµµ¬É½¸½¤½¤Î¤â¤Î¤Ç¤Ï¤Ê¤¯¡¢ ¼Â¤Ïʸ»ú¤ÎʤӤ˲᤮¤Ê¤¤¡£ ¤³¤ì¤é¤Îʸ»úÎó¤ÎÃæ¤Ëµ¤µ¤ì¤¿Ê¸»ú¤Ï¡¢¤Û¤È¤ó¤É¤Î¾ì¹ç¤Ï¤½¤Îʸ»ú¼«¿È¤ò»Ø¤¹¡£ ʸ»úÎó¤Ë¤ÏÊص¹¾å°Ê²¼¤Î¤è¤¦¤Êû½Ì·Á¤òÍѤ¤¤ë¤³¤È¤â¤Ç¤¤ë¡£ ¤¿¤À¤· SET1 ¤Þ¤¿¤Ï SET2 ¤Î¤¤¤º¤ì¤«¤Ë¤·¤« ÍѤ¤¤ë¤³¤È¤Î¤Ç¤¤Ê¤¤¤â¤Î¤â¤¢¤ë (¤³¤Î¤è¤¦¤Ê¤â¤Î¤Ë¤ÏÃíµ¤¬¤µ¤ì¤Æ¤¤¤ë)¡£¥Ð¥Ã¥¯¥¹¥é¥Ã¥·¥å¤òÍѤ¤¤¿¥¨¥¹¥±¡¼¥×
-
- \a
- Control-G
- \b
- Control-H
- \f
- Control-L
- \n
- Control-J
- \r
- Control-M
- \t
- Control-I
- \v
- Control-K
- \OOO
- OOO (1¡Á3 ·å¤Î 8 ¿Ê¿ô) ¤Ë¤è¤Ã¤Æ»ØÄꤵ¤ì¤ëʸ»ú
- \\
- ¥Ð¥Ã¥¯¥¹¥é¥Ã¥·¥åʸ»ú
ÈÏ°Ï»ØÄê
`M-N' ¤È¤¤¤Ã¤¿É½µ¤Ï¡¢ M ¤«¤é N ¤Þ¤Ç¤Î¤¹¤Ù¤Æ¤Îʸ»ú¤ò¾º½ç¤ËŸ³«¤·¤¿Ê¸»úÎó¤Ë¤Ê¤ë¡£ M ¤Ï¾È¹ç½ç½øÃæ¤Ç N ¤ÎÁ°¤Ë¤Ê¤±¤ì¤Ð¤Ê¤é¤º¡¢ ¤³¤ì¤ËÈ¿¤·¤¿¾ì¹ç¤Ï¥¨¥é¡¼¤È¤Ê¤ë¡£ Î㤨¤Ð `0-9' ¤Ï`0123456789' ¤ò»ØÄꤷ¤¿¤Î¤ÈƱ¤¸¤³¤È¤Ë¤Ê¤ë¡£ System V ÈǤΠtr ¤Ç¤ÏÈϰϤò»ØÄꤹ¤ëºÝ¤Ë³Ñ³ç¸Ì `[]' ¤òÍѤ¤¤ë¤¬¡¢ GNU ÈÇ tr ¤Ç¤Ï¤³¤Î·Á¼°¤Ï¥µ¥Ý¡¼¥È¤·¤Æ¤¤¤Ê¤¤¡£ ¤¿¤À¤·¤³¤Î·Á¼°¤Ë¤ª¤±¤ëÊÑ´¹»ØÄê¤Ï SET1 ¤È SET2 ¤Î´Ö¤Ç³Ñ³ç¸Ì¤¬Âбþ¤·¤Æ¤¤¤ì¤Ð¤Á¤ã¤ó¤ÈÆ°ºî¤¹¤ë¡£·«¤êÊÖ¤·Ê¸»ú
SET2 ¤Ë¤ª¤±¤ë `[C*N]' ¤È¤¤¤Ã¤¿É½µ¤Ï N ¸Ä¤Îʸ»ú C ¤ËŸ³«¤µ¤ì¤ë¡£ ¤·¤¿¤¬¤Ã¤Æ `[y*6]' ¤Ï `yyyyyy' ¤Ë¤Ê¤ë¡£ SET2 ¤Ë¤ª¤±¤ë `[C*]' ¤Ï SET2 ¤ò SET1 ¤ÈƱ¤¸Ä¹¤µ¤Ë¤¹¤ë¤¿¤á¤ËɬÍפʸĿô¤Îʸ»ú C ¤ËŸ³«¤µ¤ì¤ë¡£ N ¤¬ 0 ¤Ç¤Ï¤¸¤Þ¤ë¾ì¹ç¤Ï 8 ¿Ê¿ô¤È¤ß¤Ê¤µ¤ì¡¢ ¤½¤ì°Ê³°¤Î¾ì¹ç¤Ï 10 ¿Ê¿ô¤È¤ß¤Ê¤µ¤ì¤ë¡£Ê¸»ú¥¯¥é¥¹
`[:CLASS:]' ¤È¤¤¤Ã¤¿É½µ¤Ï¡¢ ¤¢¤é¤«¤¸¤áÄêµÁ¤µ¤ì¤¿Ê¸»ú¥¯¥é¥¹ CLASS ¤Î¤¹¤Ù¤Æ¤Îʸ»ú¤ËŸ³«¤µ¤ì¤ë¡£ ʸ»ú¥¯¥é¥¹¤Ë¤ÏÆÃÄê¤Î½ç½ø¤ÏÄêµÁ¤µ¤ì¤Æ¤¤¤Ê¤¤¡£ ¤¿¤À¤· `upper' ¤È `lower' ¥¯¥é¥¹¤Î¤ß¤ÏÎã³°¤Ç¡¢¾º½ç¤ËŸ³«¤µ¤ì¤ë¡£ --delete (-d) ¤ª¤è¤Ó --squeeze-repeats (-s) ¤ÎξÊý¤¬»ØÄꤵ¤ì¤¿¾ì¹ç¤Ï¡¢ SET2 ¤Ë¤Ï¤É¤ó¤Êʸ»ú¥¯¥é¥¹¤Ç¤âÍѤ¤¤ë¤³¤È¤¬¤Ç¤¤ë¡£ ¤½¤ì°Ê³°¤Î¾ì¹ç¤Ï¡¢ SET2 ¤Ë»ØÄê¤Ç¤¤ë¤Î¤Ï `lower' ¤ª¤è¤Ó `upper' ¤Î¤ß¤Ç¡¢ ¤·¤«¤â¤½¤ì¤¾¤ì¤ËÂбþ¤¹¤ë¥¯¥é¥¹ (`lower' ¤Ë¤Ï `upper'¡¢ `upper' ¤Ë¤Ï `lower') ¤¬ SET1 ¤ÎƱ¤¸°ÌÃ֤˻ØÄꤵ¤ì¤Æ¤¤¤Ê¤±¤ì¤Ð¤Ê¤é¤Ê¤¤¡£ ¤³¤Î¾ì¹ç¤ÏÂçʸ»ú¾®Ê¸»ú¤¬ÊÑ´¹¤µ¤ì¤ë¡£ ʸ»ú¥¯¥é¥¹Ì¾¤ò°Ê²¼¤Ë¼¨¤¹¡£ ¤³¤ì¤é°Ê³°¤Î̾Á°¤¬»ØÄꤵ¤ì¤¿¾ì¹ç¤Ë¤Ï¥¨¥é¡¼¤È¤Ê¤ë¡£-
- alnum
- ±Ñʸ»ú¤È¿ô»ú
- alpha
- ±Ñʸ»ú
- blank
- ¿åÊ¿Êý¸þ¤Î¶õÇò (Horizontal whitespace)
- cntrl
- À©¸æʸ»ú
- digit
- ¿ô»ú
- graph
- °õºþ¤Ç¤¤ëʸ»ú (¶õÇò¤Ï´Þ¤Þ¤Ê¤¤)
- lower
- ±Ñ¾®Ê¸»ú
- °õºþ¤Ç¤¤ëʸ»ú (¶õÇò¤â´Þ¤à)
- punct
- ¶çÆÉÅÀ
- space
- ¿åÊ¿¤ª¤è¤Ó¿âľÊý¸þ¤Î¶õÇò
- upper
- ±ÑÂçʸ»ú
- xdigit
- 16 ¿Ê¿ô¤Îʸ»ú
Åù²Á¥¯¥é¥¹
`[=C=]' ¤È¤¤¤Ã¤¿É½µ¤Ï¡¢ C ¤ÈÅù²Á¤Êʸ»ú¤ËŸ³«¤µ¤ì¤ë¡£¤³¤Î¤È¤½ç½ø¤ÏÄêµÁ¤µ¤ì¤Ê¤¤¡£ Åù²Á¥¯¥é¥¹¤Ï¡¢±Ñ¸ì°Ê³°¤Î¥¢¥ë¥Õ¥¡¥Ù¥Ã¥È¤ò¥µ¥Ý¡¼¥È¤¹¤ë¤¿¤á¤Ë ºÇ¶áȯÌÀ¤µ¤ì¤¿¤â¤Î¤Ç¤¢¤ë¡£ ¤·¤«¤·¸½ºß¤Î¤È¤³¤í¤³¤ì¤é¤ÎÄêµÁ¤äÆâÍÆ»ØÄê¤Ëɸ½àŪ¤ÊÊýË¡¤Ï¤Ê¤¤¤è¤¦¤Ç¤¢¤ë¡£ ¤·¤¿¤¬¤Ã¤Æ GNU ÈÇ tr ¤Ç¤â´°Á´¤Ë¤Ï¼ÂÁõ¤µ¤ì¤Æ¤¤¤Ê¤¤¡£ ¤½¤ì¤¾¤ì¤Îʸ»ú¤ÎÅù²Á¥¯¥é¥¹¤Ï¤½¤Îʸ»ú¤«¤é¤Î¤ß¹½À®¤µ¤ì¤Æ¤¤¤ë¡£ ¤·¤¿¤¬¤Ã¤Æ¤³¤Îµ¡Ç½¤Ï¸½ºß¤Î¤È¤³¤íÌò¤ËΩ¤¿¤Ê¤¤¡£ÊÑ´¹
tr ¤Ï SET1 ¤È SET2 ¤ÎξÊý¤¬»ØÄꤵ¤ì¤Æ¤¤¤Æ¡¢ --delete (-d) ¥ª¥×¥·¥ç¥ó¤¬»ØÄꤵ¤ì¤Æ¤¤¤Ê¤¤¾ì¹ç¤Ë¤ÏÊÑ´¹¤ò¹Ô¤¦¡£ tr ¤ÏÆþÎϤΤ¦¤Á SET1 ¤Ë¤¢¤ëʸ»ú¤ò SET2 ¤ÎÂбþ¤¹¤ë°ÌÃ֤ˤ¢¤ëʸ»ú¤ËÊÑ´¹¤¹¤ë¡£ SET1 ¤Ë̵¤¤Ê¸»ú¤Ï¤½¤Î¤Þ¤Þ½ÐÎϤµ¤ì¤ë¡£ ¤â¤·Ê¸»ú¤¬ SET1 ¤Ë 2 ²ó°Ê¾å¸½¤ï¤ì¡¢ SET2 ¤ÎÂбþ¤¹¤ëʸ»ú¤¬¤¹¤Ù¤ÆƱ¤¸¤Ç¤Ê¤¤¾ì¹ç¤Ë¤Ï¡¢ ºÇ¸å¤Îʸ»ú¤À¤±¤¬»È¤ï¤ì¤ë¡£Î㤨¤Ð°Ê²¼¤ÎÆó¤Ä¤Î¥³¥Þ¥ó¥É¤ÏÅù²Á¤Ç¤¢¤ë:-
tr aaa xyz tr a z
tr ¤ÎÎɤ¯¤¢¤ë»È¤¤Êý¤È¤·¤Æ¤Ï¡¢±Ñ¾®Ê¸»ú¤ÎÂçʸ»ú¤Ø¤ÎÊÑ´¹¤¬¤¢¤²¤é¤ì¤ë¡£ ¤¤¤í¤¤¤í¤Ê¤ä¤êÊý¤¬²Äǽ¤Ç¤¢¤ë¤¬¡¢°Ê²¼¤ËÎã¤ò 3 ¤Ä¼¨¤¹¡£
-
tr abcdefghijklmnopqrstuvwxyz ABCDEFGHIJKLMNOPQRSTUVWXYZ tr a-z A-Z tr '[:lower:]' '[:upper:]'
tr ¤¬ÊÑ´¹¤ò¹Ô¤¦ºÝ¤Ë¤Ï¡¢ SET1 ¤È SET2 ¤ÏÄ̾ïƱ¤¸Ä¹¤µ¤Ç¤Ê¤±¤ì¤Ð¤Ê¤é¤Ê¤¤¡£ SET1 ¤¬ SET2 ¤è¤êû¤¤¾ì¹ç¤Ë¤Ï¡¢ SET2 ¤ÎÈøÉô¤Î;¤ê¤Ï̵»ë¤µ¤ì¤ë¡£
µÕ¤Ë SET1 ¤ò SET2 ¤è¤êŤ¯»ØÄꤹ¤ë¤È¡¢Æ°ºî¤Ïͽ¬¤Ç¤¤Ê¤¯¤Ê¤ë¡£ POSIX.2 ¤Ë¤è¤ì¤Ð¡¢·ë²Ì¤ÏÄêµÁ¤µ¤ì¤Ê¤¤¡£ ¤³¤Î¤è¤¦¤Ê¾ì¹ç¡¢ BSD ÈÇ tr ¤Ç¤Ï SET2 ¤Î¤ê¤Ê¤¤Éôʬ¤òºÇ¸å¤Îʸ»ú¤ÇËä¤á¡¢ SET1 ¤ÈƱ¤¸Ä¹¤µ¤Ë¤¹¤ë¡£ ¤Þ¤¿ System V ÈÇ tr ¤Ï SET1 ¤ÎÈøÉô¤òÀÚ¤ê¼Î¤Æ¤Æ SET2 ¤ÈƱ¤¸Ä¹¤µ¤Ë¤¹¤ë¡£
¥Ç¥Õ¥©¥ë¥È¤Ç¤Ï GNU ÈÇ tr ¤Ï BSD ÈÇ tr ¤ÈƱ¤¸¤è¤¦¤Ë¿¶¤ëÉñ¤¦¡£ ¤Þ¤¿ --truncate-set1 (-t) ¥ª¥×¥·¥ç¥ó¤¬»ØÄꤵ¤ì¤¿¾ì¹ç¤Ë¤Ï¡¢ GNU ÈÇ tr ¤Ï System V ÈÇ tr ¤Î¤è¤¦¤Ë¿¶¤ëÉñ¤¦¡£¤³¤Î¥ª¥×¥·¥ç¥ó¤ÏÊÑ´¹°Ê³°¤ÎÅÀ¤Ë´Ø¤·¤Æ¤Ï̵»ë¤µ¤ì¤ë¡£ System V ÈÇ tr Ū¤Ê¿¶¤ëÉñ¤¤¤Î²¼¤Ç¤Ï¡¢ BSD ÈǤÎÍ̾¤ÊÍÑË¡:
-
tr -cs A-Za-z0-9 '\012'
¤Ï»È¤¨¤Ê¤¯¤Ê¤ë¡£¤³¤ì¤Ï¥¢¥ë¥Õ¥¡¥Ù¥Ã¥Èʸ»ú¤ª¤è¤Ó¿ô»ú°Ê³°¤Îʸ»ú¤ò²þ¹Ôʸ»ú ¤ËÃÖ´¹¤¹¤ë¤â¤Î¤Ç¤¢¤ë¤¬¡¢ System V ¤Ç¤ÏÆâÍƤ¬ 0 ¤Î¥Ð¥¤¥È (SET1 ¤ÎÊ佸¹ç¤ÎÀèƬÍ×ÁÇ) ¤Î¤ß¤òÊÑ´¹¤¹¤ë¤³¤È¤Ë¤Ê¤ë¡£
·«¤êÊÖ¤·¤Î°µ½Ì¤Èºï½ü
--delete (-d) ¥ª¥×¥·¥ç¥ó¤À¤±¤¬»ØÄꤵ¤ì¤¿¾ì¹ç¤Ï¡¢ tr ¤ÏÆþÎϤΤ¦¤Á SET1 ¤Ë¤¢¤ëʸ»ú¤òºï½ü¤¹¤ë¡£--squeeze-repeats (-s) ¥ª¥×¥·¥ç¥ó¤À¤±¤¬»ØÄꤵ¤ì¤¿¾ì¹ç¤Ë¤Ï¡¢ tr ¤ÏÆþÎϤΤ¦¤Á¡¢ SET1 ¤Ë¤¢¤ëʸ»ú¤Î·«¤êÊÖ¤·¤ò¡¢¤½¤Îʸ»ú 1 ʸ»ú¤ËÃÖ¤´¹¤¨¤ë¡£
--delete ¤È --squeeze-repeats ¤ÎξÊý¤Î¥ª¥×¥·¥ç¥ó¤¬»ØÄꤵ¤ì¤¿¾ì¹ç¤Ë¤Ï¡¢ tr ¤Ï¤Þ¤º SET1 ¤Ë¤¢¤ëʸ»ú¤òºï½ü¤·¡¢ »Ä¤ê¤Î¤¦¤Á SET2 ¤Ë¤¢¤ëʸ»ú¤Î·«¤êÊÖ¤·¤ò°µ½Ì¤¹¤ë¡£
--squeeze-repeats ¥ª¥×¥·¥ç¥ó¤ÏÊÑ´¹¤È¶¦¤ËÍѤ¤¤ë¤³¤È¤â¤Ç¤¤ë¡£¤³¤Î¾ì¹ç¤Ë¤Ï tr ¤Ï¤Þ¤ºÊÑ´¹¤ò¹Ô¤¤¡¢»Ä¤ê¤Îʸ»ú¤Î¤¦¤Á SET2 ¤Ë¤¢¤ë¤â¤Î¤ò°µ½Ì¤¹¤ë¡£
°Ê²¼¤Ë¤³¤ì¤é¤Î¥ª¥×¥·¥ç¥ó¤òÁȤ߹ç¤ï¤»¤¿ÍøÍÑÎã¤ò¼¨¤¹:
* ÆâÍƤ¬ 0 ¤Î¥Ð¥¤¥È¤òºï½ü¤¹¤ë:
-
tr -d '\000'
* ¤¹¤Ù¤Æ¤Îñ¸ì¤ò¤½¤ì¼«¿È¤Î¤ß¤«¤é¤Ê¤ë¹Ô¤ËÊÑ´¹¤¹¤ë¡£ ¤Ä¤Þ¤ê¥¢¥ë¥Õ¥¡¥Ù¥Ã¥Èʸ»ú¡¢¿ô»ú°Ê³°¤Îʸ»ú¤ò²þ¹Ôʸ»ú¤ËÊÑ´¹¤·¡¢ ²þ¹Ôʸ»ú¤Î·«¤êÊÖ¤·¤ò°ì¤Ä¤Î²þ¹Ôʸ»ú¤Ë°µ½Ì¤¹¤ë:
-
tr -cs '[a-zA-Z0-9]' '[\n*]'
* ²þ¹Ôʸ»ú¤Î·«¤êÊÖ¤·¤ò°ì¤Ä¤Î²þ¹Ôʸ»ú¤ËÊÑ´¹¤¹¤ë¡£
-
tr -s '\n'
* ʸ½ñÃæ¤ÎƱ¤¸Ã±¸ì¤ÎϢ³¤ò¸«¤Ä¤±¤ë¡£Î㤨¤Ð "the the" ¤Î¤è¤¦¤Ë¡¢²þ¹Ô¤ò¶´¤ó¤Çñ¸ì¤ò¥À¥Ö¤Ã¤Æ½ñ¤¤¤Æ¤·¤Þ¤¦¤³¤È¤¬¤è¤¯¤¢¤ë¡£ °Ê²¼¤Î bourne ¥·¥§¥ë¥¹¥¯¥ê¥×¥È¤Ï¡¢¤Þ¤º¶çÆÉÅÀ¤ä¶õÇò¤ÎϢ³¤ò²þ¹Ô¤ËÊÑ´¹¤¹¤ë¡£ ¤³¤ì¤Ë¤è¤Ã¤Æ¡¢³Æ¡Öñ¸ì¡×¤Ï¡¢¤½¤ì¤¾¤ì¼«Ê¬¼«¿È¤À¤±¤«¤é¤Ê¤ë¹Ô¤ËÃÖ¤«¤ì¤ë¡£ ¼¡¤ËÂçʸ»ú¤ò¾®Ê¸»ú¤ËÊÑ´¹¤·¡¢ºÇ¸å¤Ë uniq(1) ¤ò -d ¥ª¥×¥·¥ç¥ó¤Çµ¯Æ°¤·¤Æ¡¢Ï¢Â³¤·¤¿Æ±¤¸Ã±¸ì¤À¤±¤òɽ¼¨¤¹¤ë¡£
-
#!/bin/sh cat "$@" \ | tr -s '[:punct:][:blank:]' '\n' \ | tr '[:upper:]' '[:lower:]' \ | uniq -d
°Ü¿¢À
´Ä¶ÊÑ¿ô POSIXLY_CORRECT ¤ò»ØÄꤹ¤ë¤È¡¢ POSIX.2 ¤È¤Î¸·Ì©¤Ê¸ß´¹À¤ò¤È¤ë¤¿¤á¤Ë¡¢ ·Ù¹ð¤ª¤è¤Ó¥¨¥é¡¼¥á¥Ã¥»¡¼¥¸¤Î¤¤¤¯¤Ä¤«¤¬½ÐÎϤµ¤ì¤Ê¤¯¤Ê¤ë¡£ »ØÄꤷ¤Ê¤±¤ì¤Ð¡¢°Ê²¼¤Î¤è¤¦¤Ê¾ì¹ç¤Ë¥á¥Ã¥»¡¼¥¸¤¬½Ð¤ë¡£- 1.
- --delete ¥ª¥×¥·¥ç¥ó¤¬»ØÄꤵ¤ì¤Æ¤¤¤ë¤¬ --squeeze-repeats ¤¬»ØÄꤵ¤ì¤Æ¤ª¤é¤º¡¢¤«¤Ä SET2 ¤¬Í¿¤¨¤é¤ì¤Æ¤¤¤ë¾ì¹ç¤Ë¤Ï¡¢GNU ÈÇ tr ¤Ï¥Ç¥Õ¥©¥ë¥È¤Ç¤Ï»ÈÍÑË¡¤Î¥á¥Ã¥»¡¼¥¸¤òɽ¼¨¤·¤Æ½ªÎ»¤¹¤ë¡£ ¤Ê¤¼¤Ê¤é¤³¤Î¤È¤ SET2 ¤ÏÍøÍѤµ¤ì¤Ê¤¤¤«¤é¤Ç¤¢¤ë¡£ ¤·¤«¤· POSIX µ¬³Ê¤Ë¤è¤ì¤Ð¡¢ ¤³¤Î¾ì¹ç¤Ï SET2 ¤Ïñ¤Ë̵»ë¤µ¤ì¤Ê¤±¤ì¤Ð¤Ê¤é¤Ê¤¤¡£ °ú¤¿ô¤òÌۤäÆ̵»ë¤¹¤ë¤Î¤ÏÎɤ¯¤Ê¤¤»ÅÍͤÀ¤È»×¤¦¤Î¤À¤¬¡£
- 2.
- ¤¢¤¤¤Þ¤¤¤Ê 8 ¿Ê¿ô¥¨¥¹¥±¡¼¥×¤¬»ØÄꤵ¤ì¤¿¾ì¹ç¡£Î㤨¤Ð `\400' ¤Ï¼ÂºÝ¤Ë ¤Ï \40 ¤È¿ô»ú 0 ¤ÎʤӤȲò¼á¤µ¤ì¤ë¡£ ¤Ê¤¼¤Ê¤é 8 ¿Ê¿ô¤Î 400 ¤ËÂбþ¤¹¤ë¥Ð¥¤¥È¤Ï¸ºß¤·¤Ê¤¤¤«¤é¤Ç¤¢¤ë¡£
GNU ÈÇ tr ¤Ï BSD ¤ä System V ¤È¸ß´¹¤Ç¤Ï¤Ê¤¤¡£ Îã¤òµó¤²¤ì¤Ð¡¢ POSIX ÄêµÁ¤Ë¤¢¤ë `[:alpha:]', `[=c=]', `[c*10]' ¤È¤¤¤Ã¤¿»ØÄê¤Î²ò¼á¤ò»ß¤á¤µ¤»¤ë¤è¤¦¤Ê¥ª¥×¥·¥ç¥ó¤Ï¸ºß¤·¤Ê¤¤¡£ ¤Þ¤¿ GNU ÈÇ tr ¤ÏÆâÍƤ¬ 0 ¤Î¥Ð¥¤¥È¤ò¼«Æ°Åª¤Ë¤Ïºï½ü¤·¤Ê¤¤¡£ °ìÊý¤³¤ì¤Þ¤Ç¤Î UNIX ÈǤǤϡ¢¤³¤Î¥Ð¥¤¥È¤ò»Ä¤¹ÊýË¡¤ÎÊý¤¬Â¸ºß¤·¤Ê¤¤¡£
Ãí°Õ
¥×¥í¥°¥é¥à¤Î¥Ð¥°¤Ë¤Ä¤¤¤Æ¤Ï bug-textutils@gnu.org ¤ËÊó¹ð¤·¤Æ¤¯¤À¤µ¤¤¡£man ¥Ú¡¼¥¸¤Ï Ragnar Hojland Espinosa <ragnar@ragnar-hojland.com> ¤¬ºîÀ®¤·¤Þ¤·¤¿¡£
Contenus ©2006-2024 Benjamin Poulain
Design ©2006-2024 Maxime Vantorre