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-12 05:09
中国DOS联盟论坛 » DOS批处理 & 脚本技术(批处理室) » [Help] Extracting matching strings under Windows View 909 Replies 1
Original Poster Posted 2010-07-10 14:01 ·  中国 北京 中国电信北京研究院
初级用户
Credits 37
Posts 32
Joined 2008-08-21 15:50
17-year member
UID 123784
Gender Male
Status Offline
Under Windows, how can text-processing tools output matching strings? For example, if I want to output all .com domain names from a webpage's source code.
How should this be written with sed, grep, awk (are there any other programs?), etc.? Many thanks.
If I want to match .cn, .net, and other domain names, how should I use “OR” logic?

[ Last edited by nanhezzb on 2010-7-10 at 20:22 ]
Floor 2 Posted 2010-07-10 14:17 ·  中国 北京 中国电信北京研究院
初级用户
Credits 37
Posts 32
Joined 2008-08-21 15:50
17-year member
UID 123784
Gender Male
Status Offline
grep.exe -o "*\.com" should probably meet the requirement like this, but I don't know whether writing it this way is accurate. How should the other command-line ones be written?



I found a problem, for example: grep.exe -o "aa*\.com can only match aakkjkk.com and cannot match aaaaaaaakkjkk.com. Why does grep regex match from the back?

[ Last edited by nanhezzb on 2010-7-10 at 18:56 ]
Forum Jump: