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

¡ÎÌ¾Á°¡Ï
diff - ¥Õ¥¡¥¤¥ë¤Îº¹Ê¬É½¼¨

¡Î·Á¼°¡Ï
diff [ -l ] [ -r ] [ -s ] [ -cefhn ] [ -biwt ] dir1 dir2
diff [ -cefhn ] [ -biwtB ] file1 file2
diff [ -Dstring ] [ -biw ] file1 file2

¡Îµ¡Ç½ÀâÌÀ¡Ï
2¤Ä¤Î°ú¿ô¤¬¶¡¤Ë¥Ç¥£¥ì¥¯¥È¥ê¤Ç¤¢¤ë»þ¡¢diff¤Ï¥Ç¥£¥ì¥¯¥È¥ê¤ÎÃæ¤òÌ¾¾Î¤Ë¤è¤ê¥½¡¼¥È¤·¡¢°Û¤Ê¤Ã¤¿¥Æ¥­¥¹¥È¥Õ¥¡¥¤¥ë¤Ë¤Ä¤¤¤Æ¡¢ÄÌ¾ï¤Î¥Õ¥¡¥¤¥ë¤ËÂÐ¤¹¤ë diff¤Î¥¢¥ë¥´¥ê¥º¥à¤òÅ¬±þ¤·¤Þ¤¹¡£°Û¤Ê¤Ã¤¿¥Ð¥¤¥Ê¥ê¥Õ¥¡¥¤¥ë¡¢¶¦ÄÌ¤Î¥µ¥Ö¥Ç¥£¥ì¥¯¥È¥ê¡¢ÊÒÊý¤Î¥Ç¥£¥ì¥¯¥È¥ê¤Ë¤·¤«¤Ê¤¤¥Õ¥¡¥¤¥ë¤¬¤¢¤Ã¤¿»þ¤Ï¡¢¥ê¥¹¥È¤µ¤ì¤Þ¤¹¡£¥Ç¥£¥ì¥¯¥È¥ê¤òÈæ³Ó¤¹¤ë»þ¤Î¥ª¥×¥·¥ç¥ó¤Ï¼¡¤Î¤È¤¦¤ê¤Ç¤¹¡£

-l	
Ä¹¤¤½ÐÎÏ½ñ¼°¡£³Æ¥Æ¥­¥¹¥È¥Õ¥¡¥¤¥ëdiff¤òpr(1)¤ËÅÏ¤·¡¢¥Ú¡¼¥¸ÉÕ¤±¤ò¤ª¤³¤Ê¤¤¤Þ¤¹¡£¥Æ¥­¥¹¥È¥Õ¥¡¥¤¥ë¤Î°ã¤¤¤ò¤¹¤Ù¤ÆÊó¹ð¤·¤Æ¤«¤é¡¢¤½¤ÎÂ¾¤ÎÁê°ã¤¬µ­²±¤µ¤ìÍ×Ìó¤µ¤ì¤Þ¤¹¡£

-r	
¶¦ÄÌ¤Î¥µ¥Ö¥Ç¥£¥ì¥¯¥È¥ê¤¬¸¡½Ð¤µ¤ì¤ë¤È¡¢diff¤òºÆµ¢Åª¤ËÅ¬ÍÑ¤·¤Þ¤¹¡£

-s
Æ±¤¸¥Õ¥¡¥¤¥ë¤òÊó¹ð¤·¤Þ¤¹¡£°Û¤Ê¤ë¥Õ¥¡¥¤¥ë¤ÏÊó¹ð¤·¤Þ¤»¤ó¡£

-Sname
	¥Ç¥£¥ì¥¯¥È¥êdiff¤Î½èÍý¤ò¥Õ¥¡¥¤¥ëname¤«¤é³«»Ï¤·¤Þ¤¹¡£

diff¤òÀµµ¬¤Î¥Õ¥¡¥¤¥ë¾å¤Ç¼Â¹Ô¤·¤Æ¡¢¥Ç¥£¥ì¥¯¥È¥ê¤ÎÈæ³ÓÃæ¤Ë¤ª¤¤¤Æ°Û¤Ê¤Ã¤¿¥Æ¥­¥¹¥È¥Õ¥¡¥¤¥ë¤òÈæ³Ó¤·¤¿¾ì¹ç¡¢diff¤ÏÎ¾¥Õ¥¡¥¤¥ë´Ö¤Ë¤ª¤¤¤Æ°Û¤Ê¤Ã¤¿¹Ô¤òÃÎ¤é¤»¤Þ¤¹¡£¤´¤¯µ©¤Ê¾ì¹ç¤ò½ü¤¤¤Æ¡¢diff¤ÏºÇ¾®¸Â¤Î°ã¤¤¤âÈ¯¸«¤·¤Þ¤¹¡£file1 ¤Èfile2¤Î¤É¤Á¤é¤â¥Ç¥£¥ì¥¯¥È¥ê¤Ç¤Ê¤±¤ì¤Ð¡¢¤¤¤º¤ì¤«°ìÊý¤Ë'-'¤ò»ØÄê¤·¤ÆÉ¸½àÆþÎÏ¤ò»ÈÍÑ¤¹¤ë¤³¤È¤â¤Ç¤­¤Þ¤¹¡£file1¤¬¥Ç¥£¥ì¥¯¥È¥ê¤Ç¤¢¤ì¤Ðfile2¤ÈÆ±¤¸¥Õ¥¡¥¤¥ëÌ¾¤ò»ý¤Ä¤½¤Î¥Ç¥£¥ì¥¯¥È¥êÆâ¤Î¥Õ¥¡¥¤¥ë¤òfile1¤È¤·¤Æ»ÈÍÑ¤·¤Þ¤¹¡£(µÕ¤âÆ±ÍÍ)

½ÐÎÏ½ñ¼°¤Ë¤Ï¤¤¤¯¤Ä¤«¤Î¥ª¥×¥·¥ç¥ó¤¬¤¢¤ê¤Þ¤¹¡£¥Ç¥Õ¥©¥ë¥È¤Î½ÐÎÏ½ñ¼°¤Ë¤Ï¤³¤ì¤é¤Î½ñ¼°¹Ô¤¬´Þ¤Þ¤ì¤Æ¤¤¤Þ¤¹¡£

	n1 a n3,n4
	n1,n2 d n3
	n1,n2 c n3,n4
	
¤³¤ì¤é¤Î¹Ô¤Ï¡¢file1¤òfile2¤ËÊÑ´¹¤¹¤ëed¥³¥Þ¥ó¥É¤Ë»÷¤Æ¤¤¤Þ¤¹¡£Ê¸»ú¤Î¸å¤í¤Î¿ô»ú¤Ïfile2¤Ë´ØÏ¢¤ò»ý¤Ã¤Æ¤¤¤Þ¤¹¡£¼ÂºÝ¡¢a¤Èd¤òÆþ¤ìÂØ¤¨¤ÆµÕ¤ËÆÉ¤á¤Ðfile2¤òfile1¤ËÊÑ´¹¤¹¤ëÊýË¡¤ò³ÎÇ§¤Ç¤­¤Þ¤¹¡£ed¤Î¾ì¹ç¤ÈÆ±ÍÍ¤Ë¡¢n1=n2Ëô¤Ïn3=n4¤Ê¤É¤ÎÂÐ¤ÏÃ±ÆÈ¤Î¿ô¤Ë¾ÊÎ¬¤µ¤ì¤Æ¤¤¤Þ¤¹¡£

¤³¤ì¤é¤Î¹Ô¤Î¼¡¤Ë¤Ï¡¢'<'¤Ç¼¨¤¹ºÇ½é¤Î¥Õ¥¡¥¤¥ë¤Î°Û¤Ê¤Ã¤¿¹Ô¤¬¼¨¤µ¤ì¡¢¼¡¤Ë'>'¤Ç¼¨¤¹2ÈÖÌÜ¤Î¥Õ¥¡¥¤¥ë¤Î°Û¤Ê¤Ã¤¿¹Ô¤¬É½¼¨¤µ¤ì¤Þ¤¹¡£

-b¡¢-w¡¢-i¡¢-t¤Î¥ª¥×¥·¥ç¥ó¤¬Â¾¤È°ì½ï¤ËÍÑ¤¤¤é¤ì¤ë¾ì¹ç¤ò½ü¤¤¤Æ¡¢°Ê²¼¤Î¥ª¥×¥·¥ç¥ó¤Ï¡¢¸ß¤¤¤ËÇÓÂ¾Åª¤ËÍÑ¤¤¤é¤ì¤Þ¤¹¡£

-e	
ed¤ËÂÐ¤·¤Æ¡¢a¡¢c¡¢d¥³¥Þ¥ó¥É¤Î¥¹¥¯¥ê¥×¥È¤òÀ¸À®¤·¤Þ¤¹¡£¤³¤ì¤Ï¡¢file1¤«¤éfile2¤òºÆºîÀ®¤·¤Þ¤¹¡£-e¤Ë´ØÏ¢¤·¤Æ¡¢¼¡¤Î¥·¥§¥ë¥×¥í¥°¥é¥à¤ÏÊ£¿ô¤Î¥Ð¡¼¥¸¥ç¥ó¤Î¥Õ¥¡¥¤¥ë¤ò°Ý»ý¤¹¤ë¤Î¤ËÌòÎ©¤Á¤Þ¤¹¡£¤â¤È¤Î¥Õ¥¡¥¤¥ë($1)¤Èdiff¤¬À¸À®¤·¤¿°ìÏ¢¤Î¥Ð¡¼¥¸¥ç¥ó´Ö¤Îed¥¹¥¯¥ê¥×¥È($2,$3,...)¤À¤±¤¬É¬Í×¤Ç¤¹¡£'ºÇ¿·¤Î¥Ð¡¼¥¸¥ç¥ó'¤ÏÉ¸½à½ÐÎÏ¤Ë¸½¤ì¤Þ¤¹¡£

			(shift; cat $*; echo '1,$p') | ed - $1

-e¤Ç¥Ç¥£¥ì¥¯¥È¥ê¤òÈæ³Ó¤¹¤ë»þ¤Ë¤Ï½ÐÎÏ¤ËÆÃÊÌ¤Ê¥³¥Þ¥ó¥É¤¬ÄÉ²Ã¤µ¤ì¡¢2¤Ä¤Î¥Ç¥£¥ì¥¯¥È¥ê¤Ë¶¦ÄÌ¤Ê¥Æ¥­¥¹¥È¥Õ¥¡¥¤¥ë¤ò¡¢dir1¤Î¾õÂÖ¤«¤édir2¤Î¾õÂÖ¤ËÊÑ´¹¤¹¤ësh¥¹¥¯¥ê¥×¥È¤¬·ë²Ì¤È¤·¤ÆÆÀ¤é¤ì¤Þ¤¹¡£

-f	
-e¤ÈÆ±ÍÍ¤Î¥¹¥¯¥ê¥×¥È¤òÀ¸À®¤·¤Þ¤¹¤¬¡¢½ç½ø¤¬µÕ¤Ê¤Î¤Çed¤Ç¤ÏÍøÍÑ¤Ç¤­¤Þ¤»¤ó¡£

-n	
-e¤ÈÆ±ÍÍ¤Î¥¹¥¯¥ê¥×¥È¤òÀ¸À®¤·¤Þ¤¹¤¬¡¢½ç½ø¤¬µÕ¤Ç¤¢¤ê¡¢³ÆÁÞÆþËô¤Ïºï½ü¥³¥Þ¥ó¥É¤ÇÊÑ¹¹¤·¤¿¹Ô¿ô¤ò¥«¥¦¥ó¥È¤·¤Þ¤¹¡£¤³¤ì¤Ï¡¢rcfdiff(1)¤Ç»ÈÍÑ¤µ¤ì¤Æ¤¤¤ë½ñ¼°¤Ç¤¹¡£

-c	
Áê°ã¤òÁ°¸å¤Î¹Ô¤È¶¡¤Ë½ÐÎÏ¤·¤Þ¤¹¡£¥Ç¥Õ¥©¥ë¥È¤Ç¤Ï3¹Ô½ÐÎÏ¤Ç¤¹¤¬-c10¤ÈÆþÎÏ¤¹¤ë¤³¤È¤Ë¤è¤ê10¹Ô¤ËÊÑ¹¹¤¹¤ë¤³¤È¤¬¤Ç¤­¤Þ¤¹¡£-c¤ò»ÈÍÑ¤¹¤ë¤È½ÐÎÏ½ñ¼°¤¬¾¯¤·ÊÑ²½¤·¤Þ¤¹¡£½ÐÎÏ¤Ï¡¢³ºÅö¤¹¤ë¥Õ¥¡¥¤¥ë¤Î¼±ÊÌ¤È¤½¤ÎºîÀ®Æü¤Ç»Ï¤Þ¤ê¡¢³ÆÊÑ¹¹ÅÀ¤Ï12¸Ä¤Î*¤ò´Þ¤à¹Ô¤Ç¶èÀÚ¤é¤ì¤Þ¤¹¡£file1¤«¤éºï½ü¤µ¤ì¤¿¹Ô¤Ë¤Ï¡¢'-';Ëôfile2¤ËÄÉ²Ã¤µ¤ì¤¿¹Ô¤Ë¤Ï'+'¤Îµ­¹æ¤¬¤Ä¤­¤Þ¤¹¡£1¤Ä¤Î¥Õ¥¡¥¤¥ë¤«¤éÂ¾¤Î¥Õ¥¡¥¤¥ë¤Ë¹Ô¤ò¸ò´¹¤·¤¿»þ¤Ï¡¢Î¾Êý¤Î¥Õ¥¡¥¤¥ë¤Ë'!'¤¬ÉÕ¤±¤é¤ì¤Þ¤¹¡£

¤³¤³¤Ç»ØÄê¤·¤¿¿ô°ÊÆâ¤Î¹Ô¿ô¤Î¡¢Î¾¥Õ¥¡¥¤¥ëÃæ¤Ç¸¡½Ð¤µ¤ì¤¿ÊÑ¹¹²Õ½ê¤Ï¡¢¤Þ¤È¤á¤Æ½ÐÎÏ¤µ¤ì¤Þ¤¹¡£(¤³¤ì¤Ï¡¢½¾Íè¤Î'diff -c'¤òÊÑ¹¹¤·¤¿¤â¤Î¤Ç·ë²Ì¤Î½ÐÎÏ¤Ï¡¢¤Ï¤ë¤«¤Ë²ò¼á¤·¤ä¤¹¤¯¤Ê¤ê¤Þ¤·¤¿¡£)

-h	
¹âÂ®¤Ç¤¹¤¬¡¢ÀºÅÙ¤¬¤¿¤«¤¤¤È¤Ï¤¤¤¨¤Þ¤»¤ó¡£ÊÑ¹¹¤ÎÈÏ°Ï¤¬¶¹¤¯¤Ï¤Ã¤­¤êÊ¬¤«¤ì¤Æ¤¤¤ë¾ì¹ç¤Ë¤Î¤ßÍ­¸ú¤Ç¤¢¤ê¡¢¤¤¤«¤Ê¤ëÄ¹¤µ¤Î¥Õ¥¡¥¤¥ë¤Ë¤â»ÈÍÑ¤Ç¤­¤Þ¤¹¡£

-Dstring
file1¤Èfile2¤ò¥Þ¡¼¥¸¤·É¸½à½ÐÎÏ¤Ë½ñ¤­¹þ¤ß¤Þ¤¹¡£C ¥×¥ê¥×¥í¥»¥Ã¥µ¤Ë¤è¤ëÀ©¸æ¤ò´Þ¤ó¤Ç¤¤¤Þ¤¹¤«¤é¡¢string¤òÄêµÁ¤»¤º¤Ë·ë²Ì¤ò¥³¥ó¥Ñ¥¤¥ë¤¹¤ë¤³¤È¤Ïfile1¤ò¥³¥ó¥Ñ¥¤¥ë¤¹¤ë¤³¤È¤ÈÅù¤·¤¯¤Ê¤ê¤Þ¤¹¡£Ëô¡¢string¤òÄêµÁ¤¹¤ë¤Èfile2¤¬À¸À®¤µ¤ì¤Þ¤¹¡£

-b	
¸åÂ³¤Î¥Ö¥é¥ó¥¯(¥¹¥Ú¡¼¥¹¤È¥¿¥Ö)¤òÌµ»ë¤·¡¢¤½¤ÎÂ¾¤Î¥Ö¥é¥ó¥¯Ê¸»úÎó¤ò¤¹¤ÆÅù¤·¤¤¤â¤Î¤È¤ß¤Ê¤·¤Þ¤¹¡£

-w	
-b¤È»÷¤Æ¤¤¤Þ¤¹¤¬¶õÇò(¥Ö¥é¥ó¥¯¤È¥¿¥Ö)¤ò¤¹¤Ù¤ÆÌµ»ë¤·¤Þ¤¹¡£Îã¤¨¤Ðif(a == b)  ¤È if(a==b)¤ÏÆ±Åù¤Ç¤¹¡£

-i	
ÂçÊ¸»ú¤È¾®Ê¸»ú¤ò¶èÊÌ¤Þ¤»¤ó¡£Îã¤¨¤Ð¡¢'a'¤È'A'¤ÏÆ±Åù¤Ç¤¹¡£

-t	
½ÐÎÏ»þ¤Ë¥¿¥Ö¤ò³ÈÄ¥¤·¤Þ¤¹¡£ÄÌ¾ï¤Î½ÐÎÏ¤Þ¤¿¤Ï-c½ÐÎÏ¤Ç¤Ï¡¢³Æ¹Ô¤ÎÀèÆ¬¤ËÊ¸»ú¤òÄÉ²Ã¤¹¤ë¤Î¤Ç¡¢¥½¡¼¥¹¹Ô¤Î¥¤¥ó¥Ç¥ó¥È¤¬º®Íð¤·¡¢½ÐÎÏ¥ê¥¹¥È¤Î²ò¼á¤¬Æñ¤·¤¯¤Ê¤ë¤³¤È¤¬¤¢¤ê¤Þ¤¹¡£¤³¤Î¥ª¥×¥·¥ç¥ó¤Ï¡¢ÆÉ¤ß¤ä¤¹¤¯¤¹¤ë¤¿¤á¤Ë¡¢¤â¤È¤Î¥½¡¼¥¹¤Î¥¤¥ó¥Ç¥ó¥È¤òÊÝÂ¸¤¹¤ë¤â¤Î¤Ç¤¹¡£

¡ÎÆüËÜ¸ìµ¡Ç½¡Ï
Èæ³Ó¤¹¤ë¥Õ¥¡¥¤¥ëÌ¾¡¢¥Ç¥£¥ì¥¯¥È¥êÌ¾file¡¢dir ¤ËEUCÊ¸»ú¤ò´Þ¤à¤³¤È¤¬¤Ç¤­¤Þ¤¹¡£¤Þ¤¿¡¢fileÆâ¤ËEUCÊ¸»ú¤ò´Þ¤ó¤À¥Õ¥¡¥¤¥ë¤òÈæ³Ó¤¹¤ë¤³¤È¤¬¤Ç¤­¤Þ¤¹¡£

¡Î´ØÏ¢¹àÌÜ¡Ï
/tmp/d?????
/usr/lib/nje/diffh (-h¥ª¥×¥·¥ç¥ó»ÈÍÑ»þ)
/usr/nje/bin/diff ( ¥Ç¥£¥ì¥¯¥È¥êÈæ³Ó»þ)
/usr/nje/bin/pr

¡Î¿ÇÃÇ¡Ï
½ªÎ»¥¹¥Æ¡¼¥¿¥¹¤¬0¤Î»þ¡¢Áê°ã¤¬¤Ê¤«¤Ã¤¿¡£1¤Î»þ¡¢Áê°ã¤¬¤¢¤Ã¤¿¡£
2¤Î»þ¡¢¥È¥é¥Ö¥ë¤¬¤¢¤Ã¤¿¡£

¡ÎÃí°Õ»ö¹à¡Ï
-eËô¤Ï-f¥ª¥×¥·¥ç¥ó¤ò»ÈÍÑ¤·¤ÆÀ¸À®¤¹¤ëÊÔ½¸ÍÑ¥¹¥¯¥ê¥×¥È¤Ï¡¢'.'¤Ç¹½À®¤¹¤ë¹Ô¤ÎºîÀ®¤ËÉÕ¤¤¤Æ¤Ï°Õ¼±¤·¤Þ¤»¤ó¡£

-b¡¢-w¡¢-i¥ª¥×¥·¥ç¥ó¤ò»ÈÍÑ¤·¤Æ¥Ç¥£¥ì¥¯¥È¥ê¤òÈæ³Ó¤¹¤ë¾ì¹ç¡¢diff¤ÏºÇ½é¤Ë¥Õ¥¡¥¤¥ë¤òÈæ³Ó¤·(cpm¤ÈÆ±ÍÍ)¡¢Åù¤·¤¯¤Ê¤±¤ì¤Ðµ¬Äê¤Îdiff¥¢¥ë¥´¥ê¥º¥à¤ò¼Â¹Ô¤·¤Þ¤¹¡£°ã¤¤¤¬Ã±¤Ë¥Ö¥é¥ó¥¯Ê¸»úÎó¤ÎÃÙ¤ì¤ä¡¢ÂçÊ¸»ú¤È¾®Ê¸»ú¤Î°ã¤¤¤À¤±¤Ç¥Õ¥¡¥¤¥ë¤¬Æ±¤¸¤Ç¤¢¤ë¤³¤È¤¬Ê¬¤«¤Ã¤¿¾ì¹ç¤Ë¤Ï¡¢½ÐÎÏ¤¬°ìÉôÀµ¤·¤¯¤Ê¤¤¤³¤È¤¬¤¢¤ê¤Þ¤¹¡£