{"id":9614,"date":"2015-04-06T20:30:20","date_gmt":"2015-04-06T20:30:20","guid":{"rendered":"http:\/\/www.oracletutoring.ca\/blog\/?p=9614"},"modified":"2015-04-06T20:30:20","modified_gmt":"2015-04-06T20:30:20","slug":"shell-scripting-an-awk-intro","status":"publish","type":"post","link":"https:\/\/www.oracletutoring.ca\/blog\/shell-scripting-an-awk-intro\/","title":{"rendered":"Shell scripting:  an &#8220;awk&#8221; intro"},"content":{"rendered":"<h1>Among personal sharing, the tutor introduces the shell scripting language &#8220;awk&#8221;.<\/h1>\n<p>&nbsp;<br \/>\nAm I a geek?  In my home town, I probably qualify.  However, in a large centre, I&#8217;d be &#8220;geek-lite&#8221; at best.  I do program computers, but it&#8217;s not my profession.  My degree is in math, not comp-sci.  Somehow, the scientists &#8211; especially those in computer science &#8211; have first right to geekness.<\/p>\n<p>Likely, one trait counting against my geekness is the fact that I don&#8217;t use the calculator app on the computer.  Even when I&#8217;m at the computer, I use a hand-held calculator to crunch numbers.<\/p>\n<p>But what, I asked myself today, if I could calculate from the terminal?  That would appeal.  Off I went to find out about it.<\/p>\n<p>What I found was the website <a href=\"http:\/\/www.thegeekstuff.com\">thegeekstuff.com<\/a>.  What an exciting resource it is!  Sasikala has an article there about using <strong>awk<\/strong> to do math from the command line.  Here are couple of tasty examples:<\/p>\n<p>1)In the Linux terminal, the command<\/p>\n<p><span style=\"font-family:monospace;color:#22aa11\">awk &#8216;BEGIN{print sqrt(78)}&#8217;<\/span><\/p>\n<p>will give the square root of 78:<\/p>\n<p><span style=\"font-family:monospace;color:#22aa11\">8.83176<\/span><\/p>\n<p>2)In the Linux terminal, the command<\/p>\n<p><span style=\"font-family:monospace;color:#22aa11\">awk &#8216;BEGIN{print log(14)}&#8217;<\/span><\/p>\n<p>will give the <em>natural log<\/em> of 14 (aka, <em>ln14<\/em>):<\/p>\n<p><span style=\"font-family:monospace;color:#22aa11\">2.63906<\/span><\/p>\n<p>In life, we all need to make peace with some realities.  I have to face the fact that I&#8217;m probably too old to ever reach true geekness.  Yet, I&#8217;m not giving up.  <\/p>\n<p>I&#8217;m anxious to talk more about <strong>awk<\/strong> scripting:)<\/p>\n<p>Jack of <a href=\"https:\/\/www.oracletutoring.ca\">Oracle Tutoring by Jack and Diane,<\/a> Campbell River, BC.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Among personal sharing, the tutor introduces the shell scripting language &#8220;awk&#8221;. &nbsp; Am I a geek? In my home town, I probably qualify. However, in a large centre, I&#8217;d be &#8220;geek-lite&#8221; at best. I do program computers, but it&#8217;s not &hellip;<\/p>\n<p class=\"read-more\"> <a class=\"more-link\" href=\"https:\/\/www.oracletutoring.ca\/blog\/shell-scripting-an-awk-intro\/\"> <span class=\"screen-reader-text\">Shell scripting:  an &#8220;awk&#8221; intro<\/span> Read More &raquo;<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[105,3],"tags":[662,663,665,666,640,664],"class_list":["post-9614","post","type-post","status-publish","format-standard","hentry","category-computer-science","category-math","tag-awk","tag-awk-scripting","tag-bash-scripting","tag-linux-bash","tag-linux-terminal","tag-linux-terminal-scripting"],"_links":{"self":[{"href":"https:\/\/www.oracletutoring.ca\/blog\/wp-json\/wp\/v2\/posts\/9614","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.oracletutoring.ca\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.oracletutoring.ca\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.oracletutoring.ca\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.oracletutoring.ca\/blog\/wp-json\/wp\/v2\/comments?post=9614"}],"version-history":[{"count":14,"href":"https:\/\/www.oracletutoring.ca\/blog\/wp-json\/wp\/v2\/posts\/9614\/revisions"}],"predecessor-version":[{"id":9628,"href":"https:\/\/www.oracletutoring.ca\/blog\/wp-json\/wp\/v2\/posts\/9614\/revisions\/9628"}],"wp:attachment":[{"href":"https:\/\/www.oracletutoring.ca\/blog\/wp-json\/wp\/v2\/media?parent=9614"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.oracletutoring.ca\/blog\/wp-json\/wp\/v2\/categories?post=9614"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.oracletutoring.ca\/blog\/wp-json\/wp\/v2\/tags?post=9614"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}