1
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
2

1 Answer 1

2

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
6
  • 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.
    – suspectus
    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 comment curl-o should be curl -o or is that a typo?
    – suspectus
    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

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .