中国DOS联盟论坛

China DOS Union

-- Unite DOS · Advance DOS · Grow DOS --
Union site: www.cn-dos.net Forum site: www.cn-dos.net/forum
Guest | Log in | Register | Members | Search | China DOS Union
中国DOS联盟论坛
The time now is 2026-08-07 14:39
48,040 topics / 350,125 posts / today 0 new / 48,252 members
DOS批处理 & 脚本技术(批处理室) » Using sed to get a specific data block from a webpage
Printable Version  806 / 4
Floor1 jiulong Posted 2008-02-23 15:35
中级用户 Posts 183 Credits 396
For example: use SED to get 1: in "DOS Help Room", after "DOS Questions & Answers & Problem Discussion (Help Room) - China DOS Union Forum - China DOS Union's United DOS Forum", then 2: after "font-family: Tahoma, ", get the characters until the ending ";"

Because there are too many identical characters in a certain webpage, I used the source code of the CN-DOS troubleshooting section as an example

The string after 1: can't find any duplicate, so script conflicts are avoided

Not sure whether this explanation is clear enough.
Floor2 lxmxn Posted 2008-02-23 16:22
版主 Posts 4,938 Credits 11,386
That's still not clear enough. It would be best to post a piece of the source code and then mark the part that needs to be extracted.
Floor3 jiulong Posted 2008-02-23 17:58
中级用户 Posts 183 Credits 396
The following is the webpage code
<p><P><FONT color=#000000>==========2008-02-23============<BR>Giant&nbsp; <a class="channel_keylink" href="http://www.txwb.com/Article/wyzy/wyzl/SFYX/200703/5605.html" target="_blank">Love Box</a>&nbsp; <a class="channel_keylink" href="http://www.txwb.com/Article/wyzy/wyzl/GCYX/200703/5497.html" target="_blank">Loki</a>online<BR>Tears of Time&nbsp; Paradise I&nbsp; Wulin Waizhuan<BR>Super Runner Legend World MechWar<BR>Huaxia</FONT></P>
<P><FONT color=#000000><A class="" title="Article title: Employed

In SED syntax I can only go by the date (%date:~0,10%), because this is unique in the whole webpage code.

Goal: get all Chinese characters; after Huaxia, I don't want any Chinese after the code “</FONT></P>”
Keep “Huaxia”

That makes it clear now, right

If it's still not clear, look below
The characters to extract: Giant
Love Box
Loki
Tears of Time
Paradise
Wulin Waizhuan
Super Runner
Legend World
MechWar
Huaxia


[ Last edited by jiulong on 2008-2-23 at 06:07 PM ]
Floor4 lxmxn Posted 2008-02-23 19:06
版主 Posts 4,938 Credits 11,386
Floor5 jiulong Posted 2008-02-23 22:34
中级用户 Posts 183 Credits 396
No, this gets all Chinese characters. What I want is the Chinese characters from 2008- up to the first <FONT color=#000000> code.
[ Contact the Union admin team - 中国DOS联盟 - Standard version ]
Sponsored by ifanr Inc | © 2001–2023