大éã®å·¨å¤§ãªãã¡ã¤ã«ã解æããå¿ è¦ããã£ã¦ãããã°ã©ã ã®å¹çãæ¯ã¹ã¦ã¿ããcat * > /dev/null ãããã ãã§ãåäºåãããæãããæ¯æãèµ°ãããäºå®ã®ã¹ã¯ãªãããªã®ã§éããã¦ããããã®ã ãä¸åããè¡ããªãã®ãªããåäºåã§ãä¸ååã§ã大ãã¦æ°ã«ããªãã®ã ããæã®åäºåã¯å¤§å·®ãåºãã ããã§æåã«ç®ã«ä»ããã®ããæååã®æ¤ç´¢ãããæååãå«ãè¡ã¯é¤å¤ããå¾ã«ãç¹å®ã®æååãå«ãè¡ãå¦çãããgrep 㨠grep -v ãé£çµããã»ããæ©ãããawk ã®ã¿ã§å¦çããã»ããéãããæ¯ã¹ã¦ã¿ãã Solaris ã§æ¯ã¹ãã¨ãããgrep ãé£çµããã»ããã©ã¡ãã®é çªã§ãã£ã¦ã awk ã®äºåã®å®æéä¸ååæãã£ããgrep | grep -v ã§ã grep -v | grep ã§ããã¾ãå¤ãããªããawk ã ãã§å¦çãããã¨åäºåã§çµããããã®äºã¤ã®å¤§ããªéãã¨ããã°ãã¤ãã® IO
rubyã§awkã®ãããªä¸è¡ééãä½ãã rubyã¯awkã®ããã«ãã¡ã¤ã«ãä¸è¡ã㤠èªã¿è¾¼ãå¦çãå¯è½ã§ããã èµ·åãªãã·ã§ã³ãå¤ãããã¨ã§ã ç°¡åã«å®ç¾ã§ããã ãã¨ãã°ã a,b,c e,f,g h,i,j ã®ãããªãã¡ã¤ã«ãããå ´åã ruby -F, -anã'puts $F[1]'ããã¡ã¤ã«å ã¨ãã㨠b f i ç¶æ³ã¨ãã¦ã¯ ã¾ã-aãªãã·ã§ã³ã§ ä¸è¡ãã¤èªã¿åãã¢ã¼ãããªã³ã«ããã ãã®å¾-nãªãã·ã§ã³ã§ä¸è¡ãã¤$Fã«å ¥ããã ãã®ã¨ãèªåçã«-Fãªãã·ã§ã³ã§æå®ãã åºåã","ã§åå²ãããã ï¼ä¸è¡ééã®ãã¨ã¯æè¿ã¯ã¯ã³ã©ã¤ãã¼ ã¨ããããããï¼ åèãã¼ã¸ï¼ http://blog.lilyx.net/2007/11/29/writing-one-liner-in-ruby/ http://d.hatena.ne.jp/keita_yamaguchi/2008083
ã¯ããã¾ãã¦ãã¤ã³ãã©ãã¼ã ã®è åã¨ããã¾ãã ä»å¹´ã®7æã«å ¥ç¤¾ãã¦ãããã³ã³ã½ã¼ã«ã¨ã«ããã£ãããæ¯æ¥ãéããã¦ãã¾ããã¯ãã¯ãããã®ããã«ã¢ã¯ã»ã¹ã®å¤ããµã¤ãã®ãµã¼ããæ±ããã¨ãä»ã¾ã§ç¡ãã£ãã®ã§ãããããã¨åå¼·ã«ãªããã¨ãå¤ãã§ãã ãã¦ãã¤ã³ãã©ãã¼ã ã§ã¯ãµã¼ãã®ç¶æ³ãã¢ãã¿ãªã³ã°ãã¦ããµã¼ãã«åé¡ããªããã常ã«ææ¡ããããã«ãã¦ãã¾ãããã®ããæ¥å¸¸çã«tailã§ãã°ã追ãããã¦ããã®ã§ããããããªã¨ãã¯AWKãé常ã«ä¾¿å©ãªãã¨ã«æ°ä»ããæè¿ã¯ããªãAWKã«ããã£ã¦ãã¾ãã ä»åã¯çµ¶è³ãã¤ãã¼ã ä¸ã®AWKã®æ´»ç¨ä¾ããç´¹ä»ãããã¨æãã¾ãã ãªãAWKãªã®ãï¼ æ®å¿µãªããAWKã®ç¥å度ã¯ãã¾ãé«ããªãããã§ã社å ã§ãããªãRubyã§ãããªãã®ãï¼ãã¨èããããã¨ãããã¾ãããåãå ¥ç¤¾ããã¾ã§ã¯cutã®ä»£ãããããã«ãã使ã£ã¦ããªãã£ãã®ã§ãããããã¨ããã°åºåã®æ´å½¢ã«ä½¿ã£ã¦ä»¥æ¥ãAW
ãªãªã¼ã¹ãé害æ å ±ãªã©ã®ãµã¼ãã¹ã®ãç¥ãã
ææ°ã®äººæ°ã¨ã³ããªã¼ã®é ä¿¡
å¦çãå®è¡ä¸ã§ã
j次ã®ããã¯ãã¼ã¯
kåã®ããã¯ãã¼ã¯
lãã¨ã§èªã
eã³ã¡ã³ãä¸è¦§ãéã
oãã¼ã¸ãéã
{{#tags}}- {{label}}
{{/tags}}