ToDo:
É÷¼Ù¤Ð¤«¤ê¤Ò¤¤¤Æ¤ë¡£ ·î3Æü¥Ú¡¼¥¹¤Ê¤Î¤Ç¤½¤í¤½¤í½µµÙ3Æü¤Ë¶á¤¤µ¤¤¬¤¹¤ë¡£
ËͤÎÃæ¤Ç¥Ð¥Õ¥¡¥ê¥ó¤Ï»ê¹â¤ÎÌô¤Ç¤¢¤ê °ìÊý¥Ñ¥Ö¥í¥ó¤ÏÁ´¤¯¤¤«¤Ê¤¤¤Î¤À¤±¤É¡¢ Áá¤á¤Î¥Ñ¥Ö¥í¥ó¤È¤«¸À¤¦ÀëÅÁ¤Ï¡¢ ¸ú¤«¤Ê¤«¤Ã¤¿¾ì¹ç¤ÏÁ᤯°û¤Þ¤Ê¤«¤Ã¤¿¤«¤é¤À¤è¥×¥®¥ã¡¼¤È¸À¤¤Ìõ¤Ç¤¡¢ ¤¿¤¤¤·¤¿É÷¼Ù¤¸¤ã¤Ê¤¯¤Æ¤µ¤Ã¤µ¤È¼£¤Ã¤¿¾ì¹ç¤Ï ¤µ¤¹¤¬Áá¤á¥Ñ¥Ö¥í¥ó¤È¤¤¤¦¤è¤¦¤Ê´¶¤¸¤Ç Îɤ¤ÀëÅÁ¤Ê¤Î¤¸¤ã¤Ê¤¤¤Î¤À¤í¤¦¤«¤È
¤½¤¦¤¤¤¦¤É¤¦¤Ç¤â¤¤¤¤¤³¤È¤Ð¤«¤ê¤ò¹Í¤¨¤ë
(19:06)
¤Ê¤ó¤«ÀΤϤ褫¤Ã¤¿¤ó¤À¤í¤¦¤±¤É¡¢ ºÇ¶á¤Ç¤Ï
grep fuga **/*
¤È¤«¤¹¤ë¤È¤¹¤°¤Ë argument list too long ¤È¤«¸À¤ï¤ì¤Æ¤·¤Þ¤¦¡£
find . -exec grep fuga {} \;
¤Ï¤¢¤Þ¤ê¹¥¤¤Ç¤Ê¤¯¤Æ¡¢ ²¿¸Î¤Ê¤é grep ¤¬²¿Å٤ⵯư¤¹¤ë¤ó¤À¤í¤¦¤Ê¡¼¤È¤«»×¤¦¤«¤é¡£
»×¤¦¤Ëɸ½àÆþÎϤ«¤é¥Õ¥¡¥¤¥ë̾¤Î°ìÍ÷¤òÆÀ¤Æ ¤½¤ì¤¾¤ì¤ËÂФ·¤Æ¥³¥Þ¥ó¥É¤ò¼Â¹Ô¤·¤Æ¤¤¤¯¤è¤¦¤Êµ¡Ç½¤ò Á´¤Æ¤Î unix ¥³¥Þ¥ó¥É¤¬¤½¤Ê¤¨¤ë¤Ù¤¤Ê¤ó¤¸¤ã¤Ê¤¤¤À¤í¤¦¤«¡£
Î㤨¤ÐŬÅö¤Ë -= ¤È¤«¤ò»È¤¦¤È¤·¤Æ¡¢
find . | grep fuga -=
¤È¤«¤½¤¦¤¤¤¦¡£
¥¹¥¯¥ê¥×¥È¸À¸ì¤Ë¤ª¤«¤ì¤Þ¤·¤Æ¤Ï ŬÅö¤Ë -P ¤È¤« -N ¤Ç¤½¤¦¤¤¤¦½èÍý¤ò¤·¤ÆÍߤ·¤¤¡£
¤Á¤ç¤¦¤É Ruby ¤Ç¤Ï $= ¤Ï obsolete ¤À¤· Perl ¤Î $= ¤â¤¤¤é¤ó¤À¤í¡¼¤È¤¤¤¦¤³¤È¤Ç $= ¤Ëº£Æɤó¤Ç¤ë¥Õ¥¡¥¤¥ë̾¤È¤«¤¬¾¡¼ê¤ËÆþ¤Ã¤Æ¤¯¤ì¤ë¤ÈÎɤ¤¡£ ¤¢¡¢¤¤¤ä¡¢ $<.filename ¤È $ARGV ¤Ç¤¤¤¤¤Î¤«¡£
ÆÃ¤Ë Windows ¤Îʸ²½·÷¤È¤«¤Ç
command @filename
¤È¤«¤·¤¿¤é filename ¤ÎÃæ¿È¤«¤é1¹Ô¤º¤ÄÆɤ߹þ¤ó¤Ç ¤½¤ì¤ò°ú¿ô¤È¤¹¤ë¤ß¤¿¤¤¤Ê¤Î¤¬¤¢¤ë¤±¤É¡¢ ¤½¤Ã¤Á¤ÎÊý¤¬¤¤¤¤µ¤¤¬¤·¤¿¡£
find . | grep fuga @-
¤Çɸ½àÆþÎϤ«¤é¥Õ¥¡¥¤¥ë̾¤òÆɤശ¤¸¤Ç
(19:19)
Á° | 2010ǯ 3·î |
¼¡ | ||||
Æü | ·î | ²Ð | ¿å | ÌÚ | ¶â | ÅÚ |
1 | 2 | 3 | 4 | 5 | 6 | |
7 | 8 | 9 | 10 | 11 | 12 | 13 |
14 | 15 | 16 | 17 | 18 | 19 | 20 |
21 | 22 | 23 | 24 | 25 | 26 | 27 |
28 | 29 | 30 | 31 |
Á´¤Æ¥ê¥ó¥¯¥Õ¥ê¡¼¤Ç¤¹¡£ ¥³¡¼¥ÉÊҤϼ«Í³¤Ë»ÈÍѤ·¤Æ¤¤¤¿¤À¤¤¤Æ¹½¤¤¤Þ¤»¤ó¡£ ¤½¤Î¾¤Î¤â¤Î¤ÏGPL°·¤¤¤Ç¤¢¤ì¤Ð¤¢¤é¤æ¤ë»ÈÍѤ˴ؤ·¤Æʸ¶ç¤Ï¸À¤¤¤Þ¤»¤ó¡£ ¤Ê¤Ë¤«¤¢¤ì¤Ð²¼µ¥á¡¼¥ë¥¢¥É¥ì¥¹¤Ø¡£
¤à¤«¤·¤Ïargument list¤Î¥ê¥ß¥Ã¥È¤¬¸ÇÄê¤Ç32K¤·¤«¤Ê¤«¤Ã¤¿¤ó¤À¤±¤É¡¢ºÇ¶á¤Ïstack size limit¤Î1/4¤Ê¤Î¤Ç¡¢stack size limitÁý¤ä¤¹¤È¤è¤¤¤Ç¤¹¤è¡£
¤¢¤Î¥Ñ¥Ã¥Á¤Ï¤°¤°¤ë¤µ¤ó¤¬¸À¤¤½Ð¤·¤Ã¤Ú¤ÇÆþ¤Ã¤Æ¤¤¤ë¤Î¤Ç¡¢²ñ¼Ò¤Î¥Þ¥·¥ó¤Ç¤â¥Ñ¥Ã¥ÁÅö¤¿¤Ã¤Æ¤ë¤ó¤¸¤ã¤Ê¤¤¤«¤ÈͽÁÛ
¤¢¡¼¥¹¥¿¥Ã¥¯Áý¤ä¤¹¤ÈÁý¤¨¤ë¤â¤ó¤Ê¤ó¤Ç¤¹¤Í¡£¤½¤ì¤Ï¤¢¤ê¤¬¤¿¤¤¤Ç¤¹¡£
¤¢¤È xargs ¤Ç¤¤¤¤¤ó¤¸¤ã¤È¸À¤ï¤ì¤Æ xargs ¤Ã¤Æ°ú¿ô·²¤òŬÅö¤Êñ°Ì¤Ëʬ³ä¤·¤Æ¤¯¤ì¤ë¤ÈÃΤê¤Þ¤·¤¿¡Ä¤Ç¡¢
% xargs --show-limits
Your environment variables take up 3123 bytes
POSIX upper limit on argument length (this system): 2091981
POSIX smallest allowable upper limit on argument length (all systems): 4096
Maximum length of command we could actually use: 2088858
Size of command buffer we are actually using: 131072
¤È¤«¤¹¤ë¤È 2MB ¤Ç limit ¤È¤«¤¹¤ë¤È¥¹¥¿¥Ã¥¯¤Ï 8MB ¤é¤·¤¤¤Î¤Ç¡¢¤½¤Î 1/4 ¤Ï´û¤ËŬÍѤµ¤ì¤Æ¤½¤¦¤Êͽ´¶¤Ç¤¹ @¤ª¤¦¤Á¥Þ¥·¥ó
xargsÃΤé¤Ê¤«¤Ã¤¿¤È¤«ÀäÂÐͽÁۤǤ¤Ê¤¤¡£¤Ò¤Ã¤«¤±ÌäÂê¥Ò¥É¥¤
xargs ¼«ÂΤÏÃΤäƤ¿¤ó¤Ç¤¹¤¬ find . -exec command {} \; ¤ß¤¿¤¤¤Ë²¿ÅÙ¤â command Áö¤ë¤È»×¤Ã¤Æ¤Þ¤·¤¿¡Ä
ºÇ¶á¤Î GNU ¤Î find ¤Ç¤Ï -exec hoge {} + ¤Ç xargs ƱÍͤÎʬ³ä¤ò¤·¤Æ¤¯¤ì¤ë¤ß¤¿¤¤¤Ç¤¹¡¥
¤É¤¦¤Ç¤â¤¤¤¤¤Ç¤¹¤¬¡¢Ruby¤À¤È¥Õ¥¡¥¤¥ë̾¤Î¼èÆÀ¤ÏARGF.filename¤È¤«¤«¤È¡£
> ºÇ¶á¤Î GNU find
¤½¤ó¤Ê¤â¤Î¤¬¤¢¤ë¤ó¤Ç¤¹¤Í¡Ä \; ¤è¤êû¤¤¤·ÉáÃʤϤ½¤Ã¤Á»È¤Ã¤Æ¤ì¤ÐÎɤµ¤²¤Ç¤¹¤Í¡£
> ARGF
ARGF == $< ¤À¤È»×¤¤¤Þ¤¹¡£