{"id":5388,"date":"2017-12-21T11:18:57","date_gmt":"2017-12-21T09:18:57","guid":{"rendered":"http:\/\/skeletor.org.ua\/?p=5388"},"modified":"2017-12-21T11:18:57","modified_gmt":"2017-12-21T09:18:57","slug":"solaris-awk-regexp","status":"publish","type":"post","link":"https:\/\/skeletor.org.ua\/?p=5388","title":{"rendered":"[Solaris] awk + regexp"},"content":{"rendered":"<p>\u0421\u0442\u043e\u043b\u043a\u043d\u0443\u043b\u0441\u044f \u0441 \u0442\u0435\u043c, \u0447\u0442\u043e \u043f\u043e\u0434 <strong>Solaris<\/strong> <strong>awk<\/strong> \u043d\u0435 \u043f\u043e\u043d\u0438\u043c\u0430\u0435\u0442 \u043d\u043e\u0440\u043c\u0430\u043b\u044c\u043d\u043e <strong>regular expressions<\/strong>. \u041a \u043f\u0440\u0438\u043c\u0435\u0440\u0443, \u043a\u0432\u0430\u043d\u0442\u043e\u0440 \u043f\u043e\u0432\u0442\u043e\u0440\u0435\u043d\u0438\u044f <strong>{1,3}<\/strong> \u043d\u0435 \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442. \u041f\u043e\u0441\u043b\u0435 \u0433\u0443\u0433\u043b\u0435\u043d\u0438\u044f \u043d\u0430\u0448\u0451\u043b \u0437\u0430\u043c\u0435\u0442\u043a\u0443:<\/p>\n<blockquote><p><span style=\"color: #993366;\">The default awk on Solaris is old, broken awk which should never be used by anyone for any reason. nawk is much better than \/usr\/bin\/awk but is still a very old, non-POSIX awk, and so does not support RE intervals. Almost any other awk will work. On Solaris if you don&#8217;t have and can&#8217;t install GNU awk then use \/usr\/xpg4\/bin\/awk as it&#8217;s very close to POSIX compliant and does support RE intervals.<\/span><\/p><\/blockquote>\n<p>\u0412 \u0438\u0442\u043e\u0433\u0435, \u0437\u0430\u0440\u0430\u0431\u043e\u0442\u0430\u043b\u043e \u0432 \u0442\u0430\u043a\u043e\u0439 \u043a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u0438 (<strong>gawk (gnu awk)<\/strong> + \u043e\u043f\u0446\u0438\u044f <strong>posix<\/strong>):<\/p>\n<p><code>echo \"test 1.1.1.1\" | gawk --posix '{if ($2 !~ \/^127.0.0.1\/ &amp;&amp; $2 ~ \/^[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]\/) print $2 }'<\/code><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u0421\u0442\u043e\u043b\u043a\u043d\u0443\u043b\u0441\u044f \u0441 \u0442\u0435\u043c, \u0447\u0442\u043e \u043f\u043e\u0434 Solaris awk \u043d\u0435 \u043f\u043e\u043d\u0438\u043c\u0430\u0435\u0442 \u043d\u043e\u0440\u043c\u0430\u043b\u044c\u043d\u043e regular expressions. \u041a \u043f\u0440\u0438\u043c\u0435\u0440\u0443, \u043a\u0432\u0430\u043d\u0442\u043e\u0440 \u043f\u043e\u0432\u0442\u043e\u0440\u0435\u043d\u0438\u044f {1,3} \u043d\u0435 \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442. \u041f\u043e\u0441\u043b\u0435 \u0433\u0443\u0433\u043b\u0435\u043d\u0438\u044f \u043d\u0430\u0448\u0451\u043b \u0437\u0430\u043c\u0435\u0442\u043a\u0443: The default awk on Solaris is old, broken awk which should never be used by anyone for any reason. nawk is much better than \/usr\/bin\/awk but is still a very old, non-POSIX [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[10,24],"tags":[],"class_list":["post-5388","post","type-post","status-publish","format-standard","hentry","category-others","category-solaris"],"_links":{"self":[{"href":"https:\/\/skeletor.org.ua\/index.php?rest_route=\/wp\/v2\/posts\/5388","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/skeletor.org.ua\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/skeletor.org.ua\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/skeletor.org.ua\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/skeletor.org.ua\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=5388"}],"version-history":[{"count":1,"href":"https:\/\/skeletor.org.ua\/index.php?rest_route=\/wp\/v2\/posts\/5388\/revisions"}],"predecessor-version":[{"id":5389,"href":"https:\/\/skeletor.org.ua\/index.php?rest_route=\/wp\/v2\/posts\/5388\/revisions\/5389"}],"wp:attachment":[{"href":"https:\/\/skeletor.org.ua\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=5388"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/skeletor.org.ua\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=5388"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/skeletor.org.ua\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=5388"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}