linux

How to Get Stock Quote on Linux using Google ,Curl, Grep, Awk

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. Consider, we have Google Finance url for Tata Consultancy Services Stock: http://www.google.com/finance?q=NSE:TCS So, how do you get above stock price while you’re on Linux / Unix server? It’s a sinlge line command and you get your stock’s current price. 🙂 curl –silent -X Get “http://www.google.com/finance?q=NSE:TCS” > /tmp/ChangeIsInevitable && cat /tmp/ChangeIsInevitable | grep -m1 -E ‘span id=”ref_’ | awk -F “>” ‘{print $2}’ | awk -F “<” ‘{print $1}’...

crontab not working with dynamic date filename – rhel linux

I have done it for so many times, setting a cronjob. Today I was tring to set a simple cronjob which will output the log file with timestamp attached filename. Hourly running cron entry was: 0 * * * * perl demo.pl > demo-out_`date “+%Y-%m-%d_%H-%M”`.log Running the same command on shell prompt was working fine. Execute permissions and path were proper. But it kept on failing to create the proper log!! I changed the crontab as follows, added \ before % to escape and voila!! Things worked !! 0 * * * * perl test.pl > test-out_`date “+\%Y-\%m-\%d_\%H-\%M”`.log A quick lesson....