中国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-12 04:15
47,811 topics / 349,897 posts / today 0 new / 48,256 members
DOS批处理 & 脚本技术(批处理室) » [Help] Extracting matching strings under Windows
Printable Version  906 / 1
Floor1 nanhezzb Posted 2010-07-10 14:01
初级用户 Posts 32 Credits 37
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 ]
Floor2 nanhezzb Posted 2010-07-10 14:17
初级用户 Posts 32 Credits 37
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 ]
[ Contact the Union admin team - 中国DOS联盟 - Standard version ]
Sponsored by ifanr Inc | © 2001–2023