發信人Storm.bbs@bbs.sayya.org (風),
看板Programming
標 題Re: [問題] 要做個自動抓基金淨值功能
發信站SayYA 資訊站 (Sun Sep 26 20:05:16 2010)
轉信站ptt!news.ntu!ctu-gate!ctu-peer!news.nctu!News.Math.NCTU!SayYa
※ 引述《theater.bbs@ptt.cc (我在O2的年紀逐漸升高了)》之銘言:
> 如題
> http://fund.cnyes.com/Detail/historicalNav/B08,020.html
> 例如上面連結
> 想打開程式後就自動淨值更新,然後存在一個txt檔
> 我才不用每次都手動更新
> 然後我再用程式自己分析txt裡面的淨值,得到我想要的計算
> 更新的功能該如何實現呢?
wget -O - -q
http://fund.cnyes.com/Detail/historicalNav/B08,020.html \
| grep '個別基金:start' \
| sed -e 's|.*<td class="pe r">\([0-9]\+\.[0-9]\{2\}\)</td>.*|\1|g' > a.txt
產生的 a.txt 內容類似這樣:
1.77
--
※ Origin: SayYA 資訊站 <bbs.sayya.org>
◆ From: c-76-111-34-186.hsd1.ga.comcast.net
推 theater:用perl寫的嗎,好簡單有力 125.231.2.53 09/26 21:28
推 horngsh:那是unix shell script..112.104.191.119 09/26 21:29
推 theater:我要在windows上跑的 125.231.2.53 09/27 11:16
推 LPH66:是說 gnu for windows 這三個公用程式都有.. 140.112.30.133 09/27 13:17
→ LPH66:我自己就用的很高興 XD 140.112.30.133 09/27 13:17
推 loveme00835:樓上正解~140.121.197.115 09/27 15:15
推 theater:可以簡單引導要裝哪個程式,怎麼跑嗎 125.231.2.223 10/03 12:46
推 theater:三個公用程式是指 wget,grep, sed ? 125.231.2.223 10/03 12:53