.\" Copyright (c) 1991, 1993 .\" The Regents of the University of California. All rights reserved. .\" .\" This code is derived from software contributed to Berkeley by .\" the Institute of Electrical and Electronics Engineers, Inc. .\" .\" Redistribution and use in source and binary forms, with or without .\" modification, are permitted provided that the following conditions .\" are met: .\" 1. Redistributions of source code must retain the above copyright .\" notice, this list of conditions and the following disclaimer. .\" 2. Redistributions in binary form must reproduce the above copyright .\" notice, this list of conditions and the following disclaimer in the .\" documentation and/or other materials provided with the distribution. .\" 3. All advertising materials mentioning features or use of this software .\" must display the following acknowledgement: .\" This product includes software developed by the University of .\" California, Berkeley and its contributors. .\" 4. Neither the name of the University nor the names of its contributors .\" may be used to endorse or promote products derived from this software .\" without specific prior written permission. .\" .\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE .\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" .\" @(#) tr. 1 8.1 (Berkeley) 6/6/93 .\" %FreeBSD: src/usr.bin/tr/tr. 1, v 1.5. 2.7 2002/07/29 12:59:33 tjr Exp % .\" .\" $FreeBSD: doc/ja_JP.eucJP/man/man1/tr. 1, v 1.13 2002/08/11 19:49:09 horikawa Exp $ .\" .Dd October 11, 1997 .Dt TR 1 .Os .Sh ¸íĪ .Nm tr .Nd ij¸¯ÅÍÀÇ Ä¡È¯ .Sh ¼­½Ä .Nm .Op Fl csu .Ar string1 string2 .br .Nm .Op Fl cu .Fl d .Ar string1 .br .Nm .Op Fl cu .Fl s .Ar string1 .br .Nm .Op Fl cu .Fl ds .Ar string1 string2 .Sh ÇØ¼³ .Nm À¯Æ¿¸®Æ¼´Â, ¼±ÅÃµÈ Ä³¸¯Å͸¦ ¿Å°Ü³õ¾Æ ¶Ç´Â »èÁ¦Çϸ鼭 Ç¥ÁØ ÀÔ·ÂÀ» Ç¥ÁØ Ãâ·Â¿¡ Ä«ÇÇÇÕ´Ï´Ù. .Pp ÀÌÇÏÀÇ ¿É¼ÇÀ» ÀÌ¿ëÇÒ ¼ö ÀÖ½À´Ï´Ù: .Bl -tag -width Ds .It Fl c .Ar string1 ¿¡ Æ÷ÇԵǴ ij¸¯ÅÍÀÇ ¿©ÁýÇÕÀ» ³ªÅ¸³À´Ï´Ù. Áï, ``-c ab''´Â, ``a''¿Í ``b''¸¦ Á¦¿ÜÇÏ´Â ¸ðµç ij¸¯Å͸¦ Æ÷ÇÔÇÕ´Ï´Ù. .It Fl d .Fl d ¿É¼ÇÀº, ÀÔ·ÂÀ¸·ÎºÎÅÍ ÁöÁ¤ÇÑ Ä³¸¯Å͸¦ »èÁ¦ÇÕ´Ï´Ù. .It Fl s .Fl s ¿É¼ÇÀº, ¸¶Áö¸· Àμö ( .Ar string1 Àΰ¡ .Ar string2 ÀÇ ¾î´À ÂÊÀÎÁö)¿¡ Æ÷ÇԵǾî ÀÖ´Â µ¿ÀÏÇÑ Ä³¸¯ÅͰ¡, ÀԷ¾ȿ¡ ¿¬¼ÓÇØ ³ªÅ¸³¯ ¶§, ±×°ÍÀ» 1 °³ÀÇ Ä³¸¯ÅÍ¿¡ ¾ÐÃàÇÕ´Ï´Ù. ÀÌ ¾ÐÃàÀº, ¸ðµç »èÁ¦³ª º¯È¯ÀÌ ³¡³µ´Ù ÈÄ¿¡ ÇàÇØÁý´Ï´Ù. .It Fl u .Fl u ¿É¼ÇÀº Ãâ·ÂÀÌ ¹öÆÛ¸µ µÇÁö ¾Ê´Â °ÍÀ» ÇÁ·ÎÅØ¼ÇÇÕ´Ï´Ù. .El .Pp ¼­½ÄÀÇ ÃÖÃÊÀÇ Çü½Ä¿¡¼­´Â, .Ar string1 ¿¡ Æ÷ÇԵǴ ij¸¯ÅÍ´Â, .Ar string1 ÀÇ 1 ij¸¯ÅÍ´«Àº .Ar string2 ÀÇ 1 ij¸¯ÅÍ´«°ú ġȯ...(¿Í)°ú °°ÀÌ .Ar string2 (À¸)·Î ¿Å°ÜÁý´Ï´Ù. ¸¸¾à .Ar string1 ÇÏÁö¸¸ .Ar string2 º¸´Ù ±ä °æ¿ì´Â, .Ar string2 ÀÇ ¸¶Áö¸· ij¸¯ÅͰ¡, .Ar string1 (¿Í)°ú ´ëÀÀ½Ã۴µ¥ ºÎÁ·ÇÑ ºÐ¸¸Å­ °è¼ÓµÇ°í ÀÖ´Â °ÍÀ¸·Î °£ÁÖÇØÁý´Ï´Ù. .Pp ¼­½ÄÀÇ 2 ¹øÂ°ÀÇ Çü½Ä¿¡¼­´Â, .Ar string1 ¿¡ Æ÷ÇԵǴ ij¸¯ÅÍ´Â, ÀÔ·ÂÀ¸·ÎºÎÅÍ »èÁ¦µË´Ï´Ù. .Pp ¼­½ÄÀÇ 3 ¹øÂ°ÀÇ Çü½Ä¿¡¼­´Â, .Ar string1 ¿¡ Æ÷ÇԵǴ ij¸¯ÅÍ´Â, .Fl s ¿É¼ÇÀÇ ÇØ¼³´ë·Î¿¡ ¾ÐÃàµË´Ï´Ù. .Pp ¼­½ÄÀÇ 4 ¹øÂ°ÀÇ Çü½Ä¿¡¼­´Â, .Ar string1 ¿¡ Æ÷ÇԵǴ ij¸¯ÅÍ´Â ÀÔ·ÂÀ¸·ÎºÎÅÍ »èÁ¦µÇ¾î .Ar string2 ¿¡ Æ÷ÇԵǴ ij¸¯ÅÍ´Â .Fl s ¿É¼ÇÀÇ ÇØ¼³´ë·Î¿¡ ¾ÐÃàµË´Ï´Ù. .Pp .Ar string1 , .Ar string2 ÀÇ Ä³¸¯ÅÍÀÇ ÁýÇÕÀ» ÁöÁ¤Çϴµ¥, ÀÌÇÏ¿Í °°Àº ±â¼ú ¹æ¹ýÀ» ÀÌ¿ëÇÒ ¼ö ÀÖ½À´Ï´Ù: .Bl -tag -width [:equiv:] .It character ÀÌÇÏ·Î °¡¸®Å² °ÍÀ» Á¦¿ÜÇÏ´Â, ±× ij¸¯ÅÍ ÀÚ½ÅÀ» ³ªÅ¸³½´Ù Åë»óÀÇ Ä³¸¯ÅÍ (ij¸¯ÅÍ)ÀÔ´Ï´Ù. .It \eoctal backslash¿¡ °è¼ÓµÇ¾î, 1~3 ÀÚ¸®¼öÀÇ 8 Áø¼ö°¡ °è¼ÓµÈ °ÍÀº, ±× °ªÀ» encode ÇÑ Ä³¸¯Å͸¦ Ç¥ÇöÇÕ´Ï´Ù. ÀÌ 8 Áø¼öÀÇ ¹× °è¼ÓµÇ¾î ¼ýÀÚ¸¦ ij¸¯Åͷμ­ ÁöÁ¤ÇÏ°í ½ÍÀº °æ¿ì¿¡´Â, 8 Áø¼öÀÇ ÁÙÀÌ 3 ÀÚ¸®¼ö¿Í µÇµµ·Ï(µíÀÌ), 8 Áø¼öÀÇ »óÀ§ÀÚ¸®¼ö (¿ÞÂÊ)¿¡ 0 À» ¹¯¾î ÁÖ¼¼¿ä. .It \echaracter backslash¿¡ °è¼ÓµÇ´Â, ƯÁ¤ÀÇ Æ¯¼öÇÑ Ä³¸¯ÅÍ´Â, Ư¼öÇÑ °ª¿¡ ´ëÀÀÇϰí ÀÖ½À´Ï´Ù. .Pp .Bl -column "\ea" .It "\ea <º§ ij¸¯ÅÍ> .It "\eb <¹é ½ºÆäÀ̽º> .It "\ef
.It "\en <°³Çà> .It "\er <º¹±Í> .It "\et <¼öÆò ÅÇ> .It "\ev <¼öÁ÷ ÅÇ> .El .sp À̰͵é ÀÌ¿ÜÀÇ backslash¿¡ °è¼ÓµÇ´Â ij¸¯ÅÍ´Â, ±× ij¸¯ÅÍ Àڽſ¡°Ô ´ëÀÀÇÕ´Ï´Ù. .It c-c ¾ç´ÜÀ» ÁöÁ¤ÇÏ´Â °ÍÀ¸·Î½á, ij¸¯ÅÍÀÇ ¹üÀ§¸¦ ³ªÅ¸³À´Ï´Ù. ¾ç´ÜÀ» Æ÷ÇÔÇÕ´Ï´Ù. .It [:class:] Á¤ÀÇµÈ Ä³¸¯ÅÍ Å¬·¡½º¿¡ ¼ÓÇÏ´Â, ¸ðµç ij¸¯Å͸¦ ³ªÅ¸³À´Ï´Ù. Ŭ·¡½º¸íÀº ÀÌÇÏ¿Í °°½À´Ï´Ù: .sp .Bl -column "xdigit" .It "alnum <¿µ¼ýÀÚ> .It "alpha <¿µ¹®ÀÚ> .It "cntrl <ÄÁÆ®·Ñ ij¸¯ÅÍ> .It "digit <¼ýÀÚ> .It "graph <±×·¡ÇÈ Ä³¸¯ÅÍ> .It "lower <¿µ¼Ò¹®ÀÚ> .It "print <Ç¥½Ã °¡´É ij¸¯ÅÍ> .It "punct <±¸µÎÁ¡> .It "space <°ø¹é ij¸¯ÅÍ> .It "upper <¿µ´ë ij¸¯ÅÍ> .It "xdigit <16 Áø¼ö> .El .Pp .\" .Fl d .\" ¿Í .\" .Fl s .\" ÀÇ ¾çÂÊ ¸ðµÎÀÇ ¿É¼ÇÀÌ ÁöÁ¤µÇ¾úÀ» °æ¿ì¿¡´Â, .\" ¸ðµç Ŭ·¡½º¸¦ .\" .Ar string1 .\" ¹× .\" .Ar string2 .\" ¿¡ »ç¿ëÇÒ ¼ö°¡ ÀÖ½À´Ï´Ù. .\" ±×·¸Áö ¾ÊÀº °æ¿ì¿¡´Â, .\" .Ar string2 .\" ¿¡´Â, ``upper''ȤÀº ``lower'' .\" ¹Û¿¡ ÁöÁ¤ÇÒ ¼ö ¾ø½À´Ï´Ù. .\" °Ô´Ù°¡, ´ëÀÀÇϴ Ŭ·¡½º (``upper''¿¡ ´ëÇÑ ``lower'', ¿ªµµ ¸¶Âù°¡Áö)°¡ .\" .Ar string1 .\" ·Î ÁöÁ¤µÇ¾î ÀÖÀ» ¶§ ÇÑÁ¤ÇÕ´Ï´Ù. .\" .Pp ``upper''¿Í ``lower''¸¦ Á¦¿ÜÇÑ Å¬·¡½º¿¡¼­´Â, Ŭ·¡½º¿¡ Æ÷ÇԵǴ ij¸¯ÅÍÀÇ ¼ø¼­´Â ƯÁ¤µÇ°í ÀÖÁö ¾Ê½À´Ï´Ù. ``upper''¿Í ``lower''¿¡¼­´Â, ij¸¯ÅÍ´Â ½Â¼ø¿¡ ÁÙÁö¾î ÀÖ½À´Ï´Ù. .Pp ¾î¶°ÇÑ ASCII ij¸¯ÅͰ¡, ÀÌ·¯ÇÑ Å¬·¡½º¿¡ Æ÷ÇԵǾî Àִ°¡ ÇÏ´Â Á¤º¸¸¦ Á¶»çÇÏ°í ½ÍÀº °æ¿ì¿¡´Â, .Xr ctype 3 ¹× °ü·Ã ¸Þ´º¾óÀ» ÂüÁ¶ÇØ ÁÖ¼¼¿ä. .It [=equiv=] .Ar equiv (¿Í)°ú °°Àº µ¿Ä¡ °ü°è Ŭ·¡½º¿¡ ¼ÓÇÏ´Â ¸ðµç ij¸¯Å͸¦ ³ªÅ¸³À´Ï´Ù. À̰͵éÀº encodeÄ¡ÀÇ ¼ø¼­°¡ µË´Ï´Ù. .It [#*n] .Ar # ±×¸®°í ÁöÁ¤µÇ¾ú´Ù .Ar n °³ÀÇ Ä³¸¯ÅÍÀÇ ¹Ýº¹À» Ç¥ÇöÇÕ´Ï´Ù. ÀÌ Ç¥ÇöÀº, .Ar string2 ±×¸®°í ÁöÁ¤µÇ¾úÀ» ¶§ ¸¶¼Å À¯È¿ÇÕ´Ï´Ù. ¸¸¾à .Ar n ÇÏÁö¸¸ »ý·« µÇ¾úÀ» °æ¿ì, ¶Ç´Â 0 ÀÇ °æ¿ì´Â, .Ar string2 ÇÏÁö¸¸ .Ar string1 ÀÇ ±æÀ̸¦ ä¿ì´Â °Í °°Àº, ÃæºÐÈ÷ Å« °ªÀ¸·Î ÇØ¼­ ÇØ¼®µË´Ï´Ù. .Ar n (Àº)´Â, 0 À¸·Î ½ÃÀ۵Ǵ °æ¿ì¿¡´Â 8 Áø¼ö·Î¼­ ±×·¸Áö ¾ÊÀº °æ¿ì¿¡´Â 10 Áø¼ö·Î¼­ ÇØ¼®µË´Ï´Ù. .El .Sh ȯ°æ º¯¼ö .Ev LANG , .Ev LC_ALL , .Ev LC_CTYPE , .Ev LC_COLLATE ÀÇ È¯°æ º¯¼ö°¡, .Xr environ 7 ÀÇ ±â¼ú ´ë·Î¿¡, .Nm ÀÇ ½ÇÇà¿¡ ¿µÇâÀ» ÁÝ´Ï´Ù. .Sh Áø´Ü .Ex -std .Sh »ç¿ë¿¹ ÀÌÇÏÀÇ ¿¹´Â, ½©¿¡ ´ëÇØ¼­ ÁÖ¾îÁø °ÍÀÔ´Ï´Ù: .sp file1 ¿¡ Æ÷ÇԵǴ ´Ü¾î (ij¸¯ÅÍÀÇ ÃÖ´ëÀåÀÇ ÁÙ)ÀÇ ¸®½ºÆ®¸¦, °¢ Çà¿¡ ´ëÇØ 1 °³¾¿ Ãâ·ÂÇÕ´Ï´Ù. .sp . D1 Li "tr -cs \*q[:alpha:]\*q \*q\en\*q < file1" .sp file1 ÀÇ ³»¿ëÀ» ´ë¹®ÀÚ·Î º¯È¯ÇÕ´Ï´Ù. .sp . D1 Li "tr \*q[:lower:]\*q \*q[:upper:]\*q < file1" .sp Ç¥½ÃÇÒ ¼ö ¾ø´Â ij¸¯Å͸¦ file1 ·ÎºÎÅÍ »èÁ¦ÇÕ´Ï´Ù. .sp . D1 Li "tr -cd \*q[:print:]\*q < file1" .Pp ¹ßÀ½ ±¸ºÐ ±âÈ£¸¦, .Sq e ÀÇ ¿¢¼¾Æ® ÷ºÎ º¯Çü ¸ðµÎ·ÎºÎÅÍ »èÁ¦ÇÕ´Ï´Ù. .Pp .Dl "tr \*q[=e=]\*q \*qe\*q" .Sh ȣȯ¼º ¿¾ºÎÅÍÀÇ .Bx ÀÇ ½ÇÀå ¹× POSIX Ç¥ÁØ¿¡¼­´Â, ij¸¯ÅÍÀÇ ¹üÀ§ ÁöÁ¤¿¡´Â ``c-c''¶ó°í ÇÏ´Â ¹®¹ýÀ» ÀÌ¿ëÇÕ´Ï´Ù¸¸, ³°Àº System V ÀÇ ½ÇÀå¿¡¼­´Â ``[c-c]''¸¦ ÀÌ¿ëÇϰí ÀÖ½À´Ï´Ù. System V ÀÇ ¼Ð ½ºÅ©¸³Æ®´Â, ij¸¯ÅÍÀÇ Ä¡È¯À» ½Ç½ÃÇÏ·Á°í ÇÑ´Ù °æ¿ì¿¡´Â Àß µ¿ÀÛÇÒ °ÍÀÔ´Ï´Ù. Áï, ``tr [a-z] [A-Z]''¿Í ÁöÁ¤ÇßÀ» °æ¿ì¿¡´Â, .Ar string1 ÀÇ ``[''°¡ .Ar string2 ÀÇ ``[''¿¡ º¯È¯µÇ±â (À§ÇØ)¶§¹®¿¡, Àß µ¿ÀÛÇÕ´Ï´Ù. ±×·¯³ª, ¼Ð ½ºÅ©¸³Æ®°¡, ``tr -d [a-z]''¶ó°í ÇÏ´Â ¸í·É¿Í °°ÀÌ Ä³¸¯ÅÍÀÇ »èÁ¦³ª ¾ÐÃàÀ» ½Ç½ÃÇÏ´Â °æ¿ì¿¡´Â,``[''¿Í ``]''ÀÇ Ä³¸¯ÅͰ¡ »èÁ¦³ª ¾ÐÃàÀÇ ´ë»óÀ¸·Î Æ÷ÇÔµÇ¾î ¹ö¸³´Ï´Ù. ³°Àº ½ÇÀåÀÇ System V ¿¡¼­´Â ÀÌ¿Í °°ÀÌ´Â µ¿ÀÛÇÏÁö ¾Ê½À´Ï´Ù. °Ô´Ù°¡ ``a'', ``-'', ``z''¿Í ¸»ÇÏ´Â 3 °³ÀÇ Ä³¸¯Å͸¦ Ç¥ÇöÇϴµ¥, ``a-z''¿Í ±â¼úÇÏ´Â °Í °°Àº, ±× ¹× ÀÇÁ¸Çϰí ÀÖ´Â ¸ðµç ½ºÅ©¸³Æ®´Â, ``a\e-z''¿Í ¾²±â °íÄ¥ Çʿ䰡 ÀÖ½À´Ï´Ù. .Pp .Nm À¯Æ¿¸®Æ¼´Â ¿¾ºÎÅÍ, ÀԷ¿¡ À־ÀÇ NUL ¹ÙÀÌÆ®ÀÇ Á¶ÀÛÀ» ±ÝÁöµÇ°í ÀÖ¾ú½À´Ï´Ù. °Ô´Ù°¡ ÀÔ·ÂÀ¸·ÎºÎÅÍ NUL ¸¦ ¾ø¾Ö°í ÀÖ¾ú½À´Ï´Ù. ÀÌ ½ÇÀå¿¡¼­´Â, ÀÌ ÇൿÀº ¹ö±×·Î °£ÁÖÇØÁ® »èÁ¦µÇ¾ú½À´Ï´Ù. .Pp .Nm À¯Æ¿¸®Æ¼´Â ¿¾ºÎÅÍ, ¿¹¸¦ µé¾î, 2 °³ÀÇ Ä³¸¯ÅÍ ¶óÀÎÀÌ ÁöÁ¤µÇÁö ¾Ê´Â ÇÑ .Fl c ¹× .Fl s ¿É¼ÇÀ» ¹«½ÃÇÏ´Â, µîÀÇ ¹®¹ý»óÀÇ À߸øÀ» ±Ø´ÜÀûÀαîÁö Çã¶ôÇϰí ÀÖ¾ú½À´Ï´Ù. ÀÌ ½ÇÀå¿¡¼­´Â, ºÎÁ¤ÇÑ ¹®¹ýÀº ¿ë¼­µÇÁö ¾Ê°Ô µÇ¾î ÀÖÀ» °ÍÀÔ´Ï´Ù. .Sh Ç¥ÁØ .Nm À¯Æ¿¸®Æ¼´Â, .St -p1003.2 (¿Í)°ú ȣȯÀÔ´Ï´Ù. .Ar string2 ÇÏÁö¸¸ .Ar string1 º¸´Ù ªÀº °æ¿ì¿¡ .Ar string2 ÀÇ ¸¶Áö¸· ij¸¯ÅͰ¡ º¹Á¦µÇ´Â ±â´ÉÀº, POSIX ¿¡¼­´Â ¿ë¼­µÇ°í ÀÖ½À´Ï´Ù¸¸ Çʼö´Â ¾Æ´Ñ °Í¿¡ ÁÖÀÇÇØ ÁÖ¼¼¿ä. ´Ù¸¥ POSIX ½Ã½ºÅÛ¿¡ÀÇ °¡¹Ý¼ºÀÌ ÀÖ´Â ¼Ð ½ºÅ©¸³Æ®¸¦ ¸¸µé·Á°í ÇÑ´Ù¸é, ÀÌ ÇൿÀ» ¸ñÇ¥·Î ÇÏÁö ¾Ê°í ,``[#*]''¿Í ¸»Çϴ ǥÇöÀ» »ç¿ëÇØ¾ß ÇÕ´Ï´Ù. .Fl u ¿É¼ÇÀº .St -p1003.2 Ç¥ÁØÀÇ È®ÀåÀÔ´Ï´Ù.