cd documents/quoteUpdate
while true
do
curl -o quotes.txt -s "http://download.finance.yahoo.com/d/quotes.csv?s=goog,aapl&f=sl1c1p2pt1"
echo UPDATED:
date
sleep 10
done
-
possible duplicate of Using cURL command-line tool on Mac, What can I do to this script to ask it to fetch stock data which will replace commas with NO SPACES– JdeBPJan 20, 2015 at 14:00
-
@JdeBP - This question has an accepted answer, the other one doesn't (and is newer). I voted to close the other one as a duplicate rather than this one.– fixer1234Feb 1, 2015 at 1:45
Add a comment
|
1 Answer
You could use sed
to edit quotes.txt. This example changes all commas to a space character (s/,/ /g). A backup of the original file is named quotes.txt.bak.
cd documents/quoteUpdate
while true
do
curl -o quotes.txt -s "http://download.finance.yahoo.com/d/quotes.csv?s=goog,aapl&f=sl1c1p2pt1"
sed -i '.bak' 's/,/ /g' quotes.txt # replace commas with spaces
echo UPDATED:
date
sleep 10
done
-
Suspectus that was very gracious of you to answer that so quickly. I will try that out. May I revert back to you If I have any issues.Thanks Chris (Scotland) Jan 13, 2015 at 19:43
-
I just happened to stumble across the post at that time. By all means let me know if you have any problems. Jan 13, 2015 at 20:23
-
Hello suspectus, I tried that additional piece of code in the terminal to get the numerical stock data to pull without the commas. However when I run the executable it wont run properly nor will it produce produce a txt file with the data on my quoteUpdate folder on my desktop. Chris-Dormans-MacBook-Pro:~ chrisdorman$ /Users/chrisdorman/Desktop/quoteUpdate/runNow ; exit; /Users/chrisdorman/Desktop/quoteUpdate/runNow: line 4: curl-o: command not found sed: quotes.txt: No such file or directory UPDATED: Do I have to add the hashtag replace with commas with spaces into the code? Jan 14, 2015 at 13:42
-
Hi Chris - the curl command is not found - just after
line 4:
in your commentcurl-o
should becurl -o
or is that a typo? Jan 15, 2015 at 0:01 -
could you please have a look at my short screen capture with audio on Vimeo. This explains the issue which is arising. Thank you in advance of your help again. vimeo.com/116850154 Jan 15, 2015 at 12:14