{"id":1339,"date":"2010-11-12T11:58:56","date_gmt":"2010-11-12T11:58:56","guid":{"rendered":"http:\/\/kedar.nitty-witty.com\/?p=1339"},"modified":"2014-06-24T17:48:34","modified_gmt":"2014-06-24T17:48:34","slug":"how-to-get-stock-quote-on-linux-using-google-curl-grep-awk","status":"publish","type":"post","link":"https:\/\/kedar.nitty-witty.com\/blog\/how-to-get-stock-quote-on-linux-using-google-curl-grep-awk","title":{"rendered":"How to Get Stock Quote on Linux using Google ,Curl, Grep, Awk"},"content":{"rendered":"<p>If you are a Stock Market Addict and a Techie; normally working on Linux(es); this post will interest you as you still can get quote of your stock on your Linux prompt.<\/p>\n<p>Consider, we have Google Finance url for Tata Consultancy Services Stock: <em>http:\/\/www.google.com\/finance?q=NSE:TCS<\/em><\/p>\n<p>So, how do you get above stock price while you&#8217;re on Linux \/ Unix server?<br \/>\nIt&#8217;s a sinlge line command and you get your stock&#8217;s current price. \ud83d\ude42<\/p>\n<p><code>curl --silent -X Get \"http:\/\/www.google.com\/finance?q=NSE:TCS\" &gt; \/tmp\/ChangeIsInevitable &amp;&amp; cat \/tmp\/ChangeIsInevitable | grep -m1 -E 'span id=\"ref_' | awk -F \"&gt;\" '{print $2}' | awk -F \"&lt;\" '{print $1}'<\/code><\/p>\n<p>This work for other Stock Exchanges like NYSE as well:<\/p>\n<p><code>curl --silent -X Get \"http:\/\/www.google.com\/finance?q=nyse:goog\" &gt; \/tmp\/bgz &amp;&amp; cat \/tmp\/bgz | grep -m1 -E 'span id=\"ref_' | awk -F \"&gt;\" '{print $2}' | awk -F \"&lt;\" '{print $1}' &amp;&amp; date<br \/>\n617.19<br \/>\nFri Nov 12 17:07:52 IST 2010<\/code><\/p>\n<p>and that&#8217;s it. Well, I&#8217;m thinking thinking more about further extensions of this.<br \/>\nSpecial thanks goes to: Jignesh Bhai, Google, Curl, Grep, Awk.<\/p>\n","protected":false},"excerpt":{"rendered":"If you are a Stock Market Addict and a Techie; normally working on Linux(es); this post will interest you as you still can get quote of your stock on your&hellip;\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"om_disable_all_campaigns":false,"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"footnotes":""},"categories":[6],"tags":[144,145,59,143,426],"class_list":{"0":"post-1339","1":"post","2":"type-post","3":"status-publish","4":"format-standard","6":"category-technical","7":"tag-curl","8":"tag-how-to","9":"tag-linux","10":"tag-stock","11":"tag-technical"},"aioseo_notices":[],"amp_enabled":true,"_links":{"self":[{"href":"https:\/\/kedar.nitty-witty.com\/blog\/wp-json\/wp\/v2\/posts\/1339","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/kedar.nitty-witty.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/kedar.nitty-witty.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/kedar.nitty-witty.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/kedar.nitty-witty.com\/blog\/wp-json\/wp\/v2\/comments?post=1339"}],"version-history":[{"count":5,"href":"https:\/\/kedar.nitty-witty.com\/blog\/wp-json\/wp\/v2\/posts\/1339\/revisions"}],"predecessor-version":[{"id":1938,"href":"https:\/\/kedar.nitty-witty.com\/blog\/wp-json\/wp\/v2\/posts\/1339\/revisions\/1938"}],"wp:attachment":[{"href":"https:\/\/kedar.nitty-witty.com\/blog\/wp-json\/wp\/v2\/media?parent=1339"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/kedar.nitty-witty.com\/blog\/wp-json\/wp\/v2\/categories?post=1339"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/kedar.nitty-witty.com\/blog\/wp-json\/wp\/v2\/tags?post=1339"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}