China DOS Union

-- Unite DOS · Advance DOS · Grow DOS --

Union site: www.cn-dos.net Forum site: www.cn-dos.net/forum
DOS stands for freedom, openness and progress. Let us work hard, learn from the openness and GNU spirit of FreeDOS and Linux, and together build and grow a free GNU GPL world!

中国DOS联盟论坛
The time now is 2026-08-07 15:27
中国DOS联盟论坛 » DOS批处理 & 脚本技术(批处理室) » Using sed to get a specific data block from a webpage View 807 Replies 4
Original Poster Posted 2008-02-23 15:35 ·  中国 广东 深圳 罗湖区 电信
中级用户
★★
Credits 396
Posts 183
Joined 2007-12-23 06:24
18-year member
UID 106531
Gender Male
Status Offline
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.
Floor 2 Posted 2008-02-23 16:22 ·  中国 湖北 武汉 电信
版主
★★★★★
Credits 11,386
Posts 4,938
Joined 2006-07-23 17:10
20-year member
UID 59080
Status Offline
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.
Floor 3 Posted 2008-02-23 17:58 ·  中国 广东 深圳 罗湖区 电信
中级用户
★★
Credits 396
Posts 183
Joined 2007-12-23 06:24
18-year member
UID 106531
Gender Male
Status Offline
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 ]
Floor 4 Posted 2008-02-23 19:06 ·  中国 湖北 武汉 电信
版主
★★★★★
Credits 11,386
Posts 4,938
Joined 2006-07-23 17:10
20-year member
UID 59080
Status Offline
Floor 5 Posted 2008-02-23 22:34 ·  中国 广东 深圳 罗湖区 电信
中级用户
★★
Credits 396
Posts 183
Joined 2007-12-23 06:24
18-year member
UID 106531
Gender Male
Status Offline
No, this gets all Chinese characters. What I want is the Chinese characters from 2008- up to the first <FONT color=#000000> code.
Forum Jump: