{"version":"1.0","blog_title":"\u65e5\u672c GNU AWK \u30e6\u30fc\u30b6\u30fc\u4f1a 0.2","categories":["Netnews"],"image_url":"https://cdn-ak.f.st-hatena.com/images/fotolife/R/Rocco/20071005/20071005231714.png","provider_name":"Hatena Blog","published":"2007-10-31 00:00:01","title":"shell \u5909\u6570\u306e awk \u3067\u306e\u4f7f\u7528","author_name":"Rocco","provider_url":"https://hatena.blog","author_url":"https://blog.hatena.ne.jp/Rocco/","description":"shell variable in awk \u3053\u308c\u3082\u5b9a\u77f3\u3068\u8a00\u3046\u304b FAQ \u306b\u8fd1\u3044\u554f\u984c\u3067\u3059\u3002\u57fa\u672c\u7684\u306b\u306f '-v' \u30aa\u30d7\u30b7\u30e7\u30f3\u3067\u6e21\u3059\u306e\u304c\u7c21\u5358\u3067\u9593\u9055\u3044\u304c\u3042\u308a\u307e\u305b\u3093\u3002 #! /bin/bash pattern=$1 cat file.c | awk '{ if($0 ~ $pattern) print $0; }' \u3068\u3044\u3046\u3082\u306e\u304c\u52d5\u4f5c\u3057\u306a\u3044\u3068\u8a00\u3046\u3053\u3068\u3067\u3059\u304c\u3001'-v' \u3067\u6e21\u3057\u3066\u3042\u3052\u308c\u3070 OK \u3067\u3059\u3002 pattern=$1 awk -v pattern=\"$pattern\" '$0 ~ pattern' file.c","width":"100%","type":"rich","html":"<iframe src=\"https://hatenablog-parts.com/embed?url=https%3A%2F%2Frocco.hatenadiary.org%2Fentry%2F20071031%2Fp2\" title=\"shell \u5909\u6570\u306e awk \u3067\u306e\u4f7f\u7528 - \u65e5\u672c GNU AWK \u30e6\u30fc\u30b6\u30fc\u4f1a 0.2\" class=\"embed-card embed-blogcard\" scrolling=\"no\" frameborder=\"0\" style=\"display: block; width: 100%; height: 190px; max-width: 500px; margin: 10px 0px;\"></iframe>","blog_url":"https://rocco.hatenadiary.org/","url":"https://rocco.hatenadiary.org/entry/20071031/p2","height":"190"}