Deleted articles cannot be recovered. Draft of this article would be also deleted. Are you sure you want to delete this article?
ããã£ã¦ãªãã åã¯è¨æ¶åããããããªãã®ã§ãawkã®ã³ãã³ããããã«ã¡ã¢ãã¦ããã¾ãã å¤æ°ã®åãæ±ã $0 = è¡å ¨ä½ $1 = 1åç® ã¨ããé ã«ç¶ãã #æ½åº ååã ãæå® cat data.txt | awk '{print $1, $2, $4}' > hogehoge.txt ##æ¡ä»¶ä»ã 第nåãm以ä¸ã®ã¨ããæ½åº n = 3, m = 10ã¨ããã cat data.txt | awk '$3 > 10 {print}' > hogehoge.txt #æ大å¤ã»æå°å¤ 第3åã«ãããä¾ã¨ãã¦ã æå¤§å¤ cat data.txt | awk '{if(m<$3) m=$3} END{print m}' æå°å¤ cat data.txt | awk 'BEGIN{m=100000}{if(m>$3) m=$3} END{print m}' éè¤ éè¤è¡ãåé¤ cat data
2014å¹´10æ27æ¥09:00 æ ªå¼æè³ã¯ãã¾ãã¯ããã¦ã¿ããã¨ãéè¦ã ã«ãã´ãªæè³ã³ã©ã ãã®ããã°ãã覧ããã ãã¦ããæ¹ã¯æ ªå¼æè³ããã§ã«éå§ããã¦ããæ¹ãå¤ãã®ã§ã¯ãªããã¨æãã¾ãããæ ªå¼æè³ã«èå³ããã£ã¦ããã¾ãã¾ãã®ããã°ãè¦ã¤ããããæ¹ãããã£ãããããããã¾ããã ä»åã¯ãæ ªå¼æè³ãããããã¯ããããã¨ãã人ã¸ã®ã¢ããã¤ã¹ããããã¨æãã¾ãã æ ªå¼æè³ã¯ãã¾ãã¯ããã£ã¦ã¿ã¦æè¦ãã¤ããããã¨ãéè¦ã§ãã ãã¾ã¯1æ ªãæ°ä¸åã§è³¼å ¥ã§ããããã«ãªã£ã¦ãã¾ãã®ã§ã10ä¸åãããã®äºç®ã«æãã¦ããã®ä¼æ¥ã¯ä¼¸ã³ãããããªããã¨ãã1ï½2éæãè²·ã£ã¦ã¿ã¾ãããã ãªã10ä¸åã®äºç®ã§åä¸é·è ãç®æããã¨ã¯ã¾ãç¡çã ã¨æãã¾ãã ããããªããæ ªå¼æè³ã¯æåã¯ãªããªã売買ã¿ã¤ãã³ã°ãã¤ããããæãã¦å£²ãç¾½ç®ã«ãªããã¨ãå¤ãã§ãã ã¾ã¨ã¾ã£ããéãæåããçªã£è¾¼ãã§ããããªã大æãããç§ã«
2è¡ç®ã¨3è¡ç®ã表示ãã (ãã¤ãçµç±) % cat hoge.txt | awk 'NR==2,NR==3 { print }' 2è¡ç®ã¨3è¡ç®ã表示ãã (ãã¡ã¤ã«ããèªã¿è¾¼ã) % awk 'NR==2,NR==3 { print }' < hoge.txt æ¡ä»¶åå² (if else) % grep 'needle' hoge.txt \ | awk '{if($2==OK) ok++; else ng++}; END {print ok; print ng}' 第ï¼ãã£ã¼ã«ãã®ãOKããã«ã¦ã³ãããåæã«ãOK以å¤ããã«ã¦ã³ãããã æ¼ç®å && || % some_command | awk '{if($1==A && $2==B) print}' % some_command | awk '{if($1==A || $2==B) print}' 第ï¼ãã£ã¼ã«ããã1以ä¸ãã®è¡
2 åè¨ 9496 9 -rwxr-xr-x 1 root root 986672 9æ 27 2014 bash 9 -rwxr-xr-x 3 root root 30240 10æ 21 2013 bunzip2 9 -rwxr-xr-x 1 root root 1713424 11æ 15 2013 busybox 9 -rwxr-xr-x 3 root root 30240 10æ 21 2013 bzcat 11 lrwxrwxrwx 1 root root 6 10æ 21 2013 bzcmp -> bzdiff 9 -rwxr-xr-x 1 root root 2140 10æ 21 2013 bzdiff ..
ãªãªã¼ã¹ãé害æ å ±ãªã©ã®ãµã¼ãã¹ã®ãç¥ãã
ææ°ã®äººæ°ã¨ã³ããªã¼ã®é ä¿¡
j次ã®ããã¯ãã¼ã¯
kåã®ããã¯ãã¼ã¯
lãã¨ã§èªã
eã³ã¡ã³ãä¸è¦§ãéã
oãã¼ã¸ãéã
{{#tags}}- {{label}}
{{/tags}}