SORT(1)		UNIX ¥³¥Þ¥ó¥É		SORT(1)

¡ÎÌ¾Á°¡Ï
sort - ¥Õ¥¡¥¤¥ë¤Î¥½¡¼¥È/¥Þ¡¼¥¸

¡Î·Á¼°¡Ï
sort [ -mubdfinrtx ] [ +pos1  [ -pos2 ] ] ...  [ -o name ] [ -T directory ] [ name ] ... 

¡Îµ¡Ç½ÀâÌÀ¡Ï
¤³¤Î¥³¥Þ¥ó¥É¤Ï¡¢¥Õ¥¡¥¤¥ë¤ò¤Þ¤È¤á¤Æ¡¢¥½¡¼¥È¡ÊÊÂ¤Ù´¹¤¨¡Ë¡¢¥Þ¡¼¥¸¡Êº®¹ç¡Ë¤·¤½¤Î·ë²Ì¤òÄê¤á¤é¤ì¤¿¥Õ¥¡¥¤¥ë¡Ê¥Ç¥Õ¥©¥ë¥È¤ÏÉ¸½à½ÐÎÏ¡Ë¤Ë½ñ¤­½Ð¤·¤Þ¤¹¡£¥½¡¼¥È¤ÎÂÐ¾Ý¤È¤Ê¤ë¥­¡¼¤¬Äê¤á¤é¤ì¤Æ¤¤¤Ê¤¤¾ì¹ç¤Ï¥Ç¥Õ¥©¥ë¥È¤Ï¥é¥¤¥ó¤Î¤¹¤Ù¤Æ¤Ç¤¹¡£¥Õ¥¡¥¤¥ë¤ÏÊ£¿ô¤Î¥­¡¼¤Ç¥½¡¼¥È¤¹¤ë¤³¤È¤¬¤Ç¤­¡¢¥ª¥×¥·¥ç¥ó¤Ë¤è¤êÄê¤á¤é¤ì¤¿¤è¤¦¤ËÊÂ¤Ù¤é¤ì¤Þ¤¹¡£

¡Î¥ª¥×¥·¥ç¥ó¡Ï
-b	
¤³¤Î¥ª¥×¥·¥ç¥ó¤Ï¡¢¥Õ¥£¡¼¥ë¥É¤ÎÈæ³Ó¤Ë¤ª¤¤¤Æ¡¢¥Ö¥é¥ó¥¯¡Ê¥¹¥Ú¡¼¥¹¤ä¥¿¥Ö¡Ë¤òÌµ»ë¤·¤Þ¤¹¡£

-c
ÆþÎÏ¥Õ¥¡¥¤¥ë¤¬·è¤á¤é¤ì¤¿½ç½ø¤Ç¥½¡¼¥È¤µ¤ì¤Æ¤¤¤ë¤«¤ò¥Á¥§¥Ã¥¯¤·¤Þ¤¹¡£¥½¡¼¥È¤µ¤ì¤Æ¤¤¤Ê¤¤¤È¤­¤Ï¥á¥Ã¥»¡¼¥¸¤ò½ÐÎÏ¤·¤Þ¤¹¡£

-d
¼­½ñ¼°¤ËÊÂ¤Ù´¹¤¨¤Þ¤¹¡£Ê¸»ú¡¢·å¡¢¥Ö¥é¥ó¥¯¤Î¤ß¤òÈæ³Ó¤ÎÂÐ¾Ý¤È¤·¤Þ¤¹¡£

-f
ÂçÊ¸»ú¤ò¾®Ê¸»ú¤È¸«¤Ê¤·¤Þ¤¹¡£

-i
¿ô»úÈæ³Ó°Ê³°¤Ë¤ª¤¤¤Æ¡¢ASCII¥³¡¼¥É¤ÎÈÏ°Ï¡Ê040-0176¡Ë¤ò±Û¤¨¤¿¤â¤Î¤òÌµ»ë¤·¤Þ¤¹¡£

-m name
¤³¤Î¥ª¥×¥·¥ç¥ó¤Ï¡¢name¤Ç»ØÄê¤·¤¿¥Õ¥¡¥¤¥ë¤ò¥Þ¡¼¥¸¤¹¤ë¤è¤¦¤ËÄê¤á¤Þ¤¹¡£ÁÐÊý¤Î¥Õ¥¡¥¤¥ë¤Ï¤¹¤Ç¤Ë¥½¡¼¥È¤µ¤ì¤Æ¤¤¤ëÉ¬Í×¤¬¤¢¤ê¤Þ¤¹¡£

-n
¥¹¥È¥ê¥ó¥°¥¹¤Î¿ô»ú¤ÎÉôÊ¬¤ò»»½ÑÅª¤ÊÃÍ¤È¤·¤Æ¥½¡¼¥È¤·¤Þ¤¹¡£¿ô»ú¤Î¥¹¥È¥ê¥ó¥°¥¹¤È¤Ï¥Ö¥é¥ó¥¯¡¢¥Þ¥¤¥Ê¥¹¡¢Åù¹æ¡¢¾®¿ôÅÀ¡¢¥¼¥í¤Ê¤É¤«¤é¹½À®¤µ¤ì¤Þ¤¹¡£

-o name
¥½¡¼¥È¤·¤Æ¤½¤Î·ë²Ì¤òname¤Ç»ØÄê¤·¤¿¥Õ¥¡¥¤¥ë½ÐÎÏ¤·¤Þ¤¹¡£¤³¤Î¥ª¥×¥·¥ç¥ó¤òÉÕ¤±¤Ê¤¤¤ÈÉ¸½à½ÐÎÏ¤Ë½ÐÎÏ¤·¤Þ¤¹¡£

-r
¹ß½ç¤Ë¥½¡¼¥È¡ÊÎã¤¨¤Ð¡¢¿ô»ú¤ÎÂç¤­¤¤ÃÍ¤Î½ç¡Ë¤·¤Þ¤¹¡£

-tx
t¤Ï¡¢¥Ç¥Õ¥©¥ë¥È¤ÇÍÑ¤¤¤é¤ì¤Æ¤¤¤ë¥Ö¥é¥ó¥¯¤Ç¤Ï¤Ê¤¯¡¢Ç¤°Õ¤Î¥­¥ã¥é¥¯¥¿¤ò¥»¥Ñ¥ì¡¼¥¿¤È¤·¤ÆÄê¤á¤Þ¤¹¡£x¤Ï¡¢¼ÂºÝ¤Ë¥»¥Ñ¥ì¡¼¥¿¤È¤·¤ÆÍÑ¤¤¤é¤ì¤ë¥­¥ã¥é¥¯¥¿¤Ç¤¹¡£

-t directory
ÄÌ¾ï¡¢¥½¡¼¥È¤Îºî¶È¤Ï¡¢/tmp¥Ç¥£¥ì¥¯¥È¥ê¤Ç¥Æ¥ó¥Ý¥é¥ê¥Õ¥¡¥¤¥ë¤òºî¤Ã¤Æ¹Ô¤ï¤ì¤Þ¤¹¤¬¡¢¤³¤Î¾ì¹çT¤ËÂ³¤¯¥Ç¥£¥ì¥¯¥È¥ê¤Ë¤ª¤¤¤Æºî¶È¤ò¤ª¤³¤Ê¤¤¤Þ¤¹¡£

-u
2¤Ä°Ê¾å¤Î¥é¥¤¥ó¤¬¡¢Æ±¤¸¥­¡¼¤Ë¥Þ¥Ã¥Á¤·¤¿¤È¤­¤Ë¡¢1¤Ä¤À¤±½ÐÎÏ¤µ¤ì¤Þ¤¹¡£
½ÅÊ£Åù¤ò¤µ¤±¤ë¤¿¤á¤Ç¤¹¡£

¥½¡¼¥È¤Î¤¿¤á¤Î¥­¡¼¤òÄê¤á¤ë¤Î¤Ë¤Ï¡¢°ú¿ô¡Ê+pos1¤È-pos2¡Ë¤ò»È¤¤¤Þ¤¹¡£¤³¤ì¤é¤Î³Æ¥Ú¥¢¤Ï¡¢¥½¡¼¥È¥­¡¼¤òpos1¤«¤épos2¤ÎÄ¾Á°¤Ç½ª¤ï¤ë¥Õ¥£¡¼¥ë¥É¤ËÀ©¸Â¤·¤Þ¤¹¡£pos1µÚ¤Ópos2¤Ï¡¢¶¦¤Ëm.n¤Î·Á¤ÇÍ¿¤¨¤Ê¤±¤ì¤Ð¤Ê¤ê¤Þ¤»¤ó¡£m¤Ï¡¢¥¹¥­¥Ã¥×¤¹¤ë¥Õ¥£¡¼¥ë¥É¿ô¤òÉ½¤·¡¢n¤Ï¡¢¤½¤Î¥Õ¥£¡¼¥ë¥É¤Ë¤ª¤¤¤Æ¥¹¥­¥Ã¥×¤¹¤ë¥­¥ã¥é¥¯¥¿¿ô¤òÉ½¤·¤Þ¤¹¡£

¡ÎÆüËÜ¸ìµ¡Ç½¡Ï
-
ºÇ½é¤ËÉ¸½àÆþÎÏ¤«¤éÆÉ¤ß¹þ¤ß¤Þ¤¹¡£

-b
¹Ô¤ÎÀèÆ¬¤Î¶õÇò¤òÌµ»ë¤·¤Þ¤¹¡£

-d
¼­½ñ¼°½ç½ø¡§±Ñ»ú¡¢¿ô»ú¡¢¶õÇò¤Î¤ß¤¬°ÕÌ£¤ò»ý¤Á¤Þ¤¹¡£

-f
ASCII¤ÎÂçÊ¸»ú¤È¾®Ê¸»ú¤ò¶èÊÌ¤·¤Þ¤»¤ó¡£

-i
´Á»ú¡¢È¾³Ñ¥«¥Ê¡¢³°»ú¤ÎÊ¸»ú¤òÌµ»ë¤·¤Þ¤¹¡£

-n
¿ôÃÍ¤Î½ç¤Ë¥½¡¼¥È¤·¤Þ¤¹¡£

-tx
x¤ò¥ï¡¼¥É¶èÀÚ¤êÊ¸»ú¤È¤·¤Æ»ÈÍÑ¤·¤Þ¤¹¡£¥¹¥Ú¡¼¥¹Ê¸»ú¤È¤Ï°Û¤Ê¤ê¡¢¤³¤³¤Ç»ØÄê¤·¤¿¶èÀÚ¤êÊ¸»ú¤¬Ï¢Â³¤·¤Æ¸½¤ì¤ë¤È¡¢¤½¤Î³Æ¡¹¤¬¥ï¡¼¥É¤Î¶èÀÚ¤ê¤ò¼¨¤·¤Þ¤¹¡£¤¿¤È¤¨¤Ð¡¢¡§¤ò¶èÀÚ¤êÊ¸»ú¤È¤·¤¿¾ì¹ç¡¢¡§¡§¤Ï¡Ö¶õ¤Î¥ï¡¼¥É¡×¤ò¶èÀÚ¤ê¤Þ¤¹¡£
¡ÊÁ´³ÑÊ¸»ú¤â¶èÀÚ¤ê¤Ë¤Ç¤­¤Þ¤¹¡£¡Ë

¡Î»ÈÍÑÎã¡Ï
list¤È¤¤¤¦¥Õ¥¡¥¤¥ëÆâ¤Î¥ï¡¼¥É¤Î¥ê¥¹¥È¤ò¥¢¥ë¥Õ¥¡¥Ù¥Ã¥È½ç¤Ë¥½¡¼¥È¤·¤Æ°Û¤Ê¤ëÄÖ¤ê¤Î¤â¤Î¤À¤±¤ò¤¹¤Ù¤Æ½ÐÎÏ¤·¤Þ¤¹¡£ÂçÊ¸»ú¤È¾®Ê¸»ú¤Ï¶èÊÌ¤·¤Þ¤¹¡£
		sort -u +0f +0 list

¥Ñ¥¹¥ï¡¼¥É¥Õ¥¡¥¤¥ë¤ò¥æ¡¼¥¶ID(¥³¥í¥ó¤Ç¶èÀÚ¤é¤ì¤¿3ÈÖÌÜ¤Î¥Õ¥£¡¼¥ë¥É)¤Ç¥½¡¼¥È¤·¤Æ½ÐÎÏ¤·¤Þ¤¹¡£
		sort -t: +2n /etc/passwd

(month day)¥¨¥ó¥È¥ê¤«¤é¹½À®¤µ¤ì¤ë¥Õ¥¡¥¤¥ë¤¬´û¤Ë¥½¡¼¥È¤µ¤ì¤Æ¤¤¤ë¾ì¹ç¤Ë¡¢³Æmonth¤Ë¤Ä¤¤¤ÆºÇ½é¤Î¥¤¥ó¥¹¥¿¥ó¥¹¤ò½ÐÎÏ¤·¤Þ¤¹¡£ÆþÎÏ¥Õ¥¡¥¤¥ë¤¬°ì¤Ä¤Î¾ì¹ç¤Ë¡¢-um¥ª¥×¥·¥ç¥ó¤ò»ØÄê¤¹¤ë¤È¡¢Í½ÁÛ¤µ¤ì¤ëÆ±°ì¹Ô¤Î½¸¹ç¤«¤é¡¢¤¿¤À°ì¤Ä¤ÎÂåÉ½¤òÁªÂò¤¹¤ë¤³¤È¤¬¤Ç¤­¤Þ¤¹¡£
		sort -um +0 -1 dates

¡ÖÉ¸½àÅª¤Ê¡×¥Ç¡¼¥¿¥Ù¡¼¥¹¥Õ¥¡¥¤¥ë(¤¹¤Ê¤ï¤Á¡¢¥Õ¥¡¥¤¥ë¤Î³Æ¥Õ¥£¡¼¥ë¥É¤¬¥¿¥Ö¤Ç¶èÀÚ¤é¤ì¤Æ¤¤¤ë¤â¤Î)¤ò¡¢2ÈÖÌÜ¤Î¥Õ¥£¡¼¥ë¥É¤Ç¥½¡¼¥È¤·¤Þ¤¹¡£
		sort -t\^V^I +1 file
^I¤Ï¡¢¼¡¤Î¤è¤¦¤Ê2ÄÌ¤ê¤ÎÊýË¡¤Ç¥·¥§¥ë¤ËÂÐ¤·¤Æ¥¯¥¦¥©¡¼¥È¤¹¤ëÉ¬Í×¤¬¤¢¤ê¤Þ¤¹¡£
(1) ^V¤Ï¡¢¥¿¥Ö¤¬¶õÇò¤ËÃÖ´¹¤µ¤ì¤ë¤Î¤òËÉ¤®¤Þ¤¹¡£(¤¹¤Ê¤ï¤Á¡¢¥­¡¼¥Ü¡¼¥É¤ÎTAB¥­¡¼¤ò²¡¤·¤¿»þ¤ÎºîÍÑ¤Ç¤¹¡£)
(2) ¥Ð¥Ã¥¯¥¹¥é¥Ã¥·¥å(\)¤Ï¡¢sort¥×¥í¥°¥é¥à¤ËÂÐ¤·¤Æ¥¿¥Ö¤ò¥¯¥¦¥©¡¼¥È¤·¤Þ¤¹¡£(¤¹¤Ê¤ï¤Á¡¢¥­¡¼¥Ü¡¼¥É¤ÎRETURN¥­¡¼¤ò²¡¤·¤¿¸å¤ÎºîÍÑ¤Ç¤¹¡£)

¥­¡¼¤¬15ÈÖÌÜ¤ÎÊ¸»ú¤Ç»Ï¤Þ¤ê¡¢18ÈÖÌÜ¤ÎÊ¸»ú¤Ç½ªÎ»¤¹¤ë¤â¤Î¤Ç¡¢¥Õ¥¡¥¤¥ë¤ò¥½¡¼¥È¤·¤Þ¤¹¡£
		sort +0.15 -0.18 file

¡Î¥Õ¥¡¥¤¥ë¡Ï
/usr/tmp/stm*, /tmp/*	°ì»þ¥Õ¥¡¥¤¥ë¤Ë»ÈÍÑ¤µ¤ì¤Þ¤¹¡£

¡Î´ØÏ¢¹àÌÜ¡Ï
comm(1), join(1), rev(1), uniq(1)

¡Î¿ÇÃÇ¡Ï
³Æ¼ï¤Î°Û¾ï¤¬È¯À¸¤·¤¿¾ì¹ç¡¢-c¥ª¥×¥·¥ç¥ó¤Î²¼¤ÇÌ¤¥½¡¼¥È¤Î¾õÂÖ¤¬È¯¸«¤µ¤ì¤¿¾ì¹ç¤Ë¤Ï¥³¥á¥ó¥È¤ò½ÐÎÏ¤·¡¢0°Ê³°¤Î¥¹¥Æ¡¼¥¿¥¹¤Ç½ªÎ»¤·¤Þ¤¹¡£

¡ÎÃí°Õ»ö¹à¡Ï
M¡Êlocale¥Æ¡¼¥Ö¥ë¤«¤é¤Î·îÌ¾¤È½ç½ø¤ò»ÈÍÑ¤¹¤ë¡Ë¥ª¥×¥·¥ç¥ó¤Ï¥µ¥Ý¡¼¥È¤·¤Æ¤¤¤Þ¤»¤ó¡£