Retrieve stock value using shell script
September19
we can use wget command to retrieve the stock value of given stock symbol from google finance website.
Shell script
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | #!/bin/bash # This script is used to retrieve the stock value from finance.google.com # Author : Kamaraj Subramanian # Website : www.thelinuxtips.com echo -n "Enter the Stock Symbol : " read stocksymbol googleURL="http://finance.google.com/finance/info?client=ig\&q=NASDAQ%3a" #Retrieve the stock value wget $googleURL$stocksymbol -O /tmp/o.txt 2>/dev/null stockvalue=$(awk '/,\"l\"/{print $NF}' /tmp/o.txt) echo "Stock value of $stocksymbol is : $stockvalue" <span style="text-decoration: underline;"><strong>Output</strong></span> |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 | #GOOGLE $ ./stockvalue.sh Enter the Stock Symbol : GOOG Stock value of GOOG is : "724.07" #YAHOO $ ./stockvalue.sh Enter the Stock Symbol : YHOO Stock value of YHOO is : "15.89" #MICROSOFT $ ./stockvalue.sh Enter the Stock Symbol : MSFT Stock value of MSFT is : "31.14" #APPLE $ ./stockvalue.sh Enter the Stock Symbol : AAPL Stock value of AAPL is : "701.23" #FACEBOOK $ ./stockvalue.sh Enter the Stock Symbol : FB Stock value of FB is : "22.86" |
Recent Comments