[新手上路]批处理新手入门导读[视频教程]批处理基础视频教程[视频教程]VBS基础视频教程[批处理精品]批处理版照片整理器
[批处理精品]纯批处理备份&还原驱动[批处理精品]CMD命令50条不能说的秘密[在线下载]第三方命令行工具[在线帮助]VBScript / JScript 在线参考
返回列表 发帖

[文本处理] 批处理怎样提取XML代码中的.html链接?

多个xml文件中,提取http://*****.html   的链接网址

用geturls提取   type *.xml | GetURLs > url.txt

会提取到不是html结尾的链接。

请教,怎么用批处理 批量提取多个xml文件中的 http://*****.html   链接到txt中~谢谢~

grep -o "http.*html" sitemap.xml
grep -o "http.*html" *.xml

TOP

再请问一下,grep 命令么,win系统可以用吗?
这个命令怎么输出结果到txt呢

TOP

这里有提供下载
http://www.bathome.net/s/tool/?key=grep

http://bcn.bathome.net/tool/3.0/grep.exe
输出结果 在命令末尾尾加 >sitemap.txt

TOP

谢谢~~可以提取了。不过提取出来的 链接前面带有源文件名。。囧,这个能去掉马?

TOP

--no-filename

TOP

回复 6# 523066680


    您好可以再详细一点吗

TOP

grep -o -h  "http.*jpg" *.xml  >网址.txt
原来是这样就可以了 感谢

TOP

Regexp selection and interpretation:

Regexp选择和解释:

-E, --extended-regexp PATTERN is an extended regular expression (ERE)

-E,--扩展regexp模式是一个扩展正则表达式(ERE)

-F, --fixed-strings PATTERN is a set of newline-separated strings

-F,--固定字符串模式是一组换行分隔字符串

-G, --basic-regexp PATTERN is a basic regular expression (BRE)

-G,--basic regexp模式是一个基本正则表达式(BRE)

-P, --perl-regexp PATTERN is a Perl regular expression

-P,--perl regexp模式是一个perl正则表达式

-e, --regexp=PATTERN use PATTERN for matching

-e,--regexp=用于匹配的模式使用模式

-f, --file=FILE obtain PATTERN from FILE

-f,--file=文件从文件获取模式

-i, --ignore-case ignore case distinctions

-i,--忽略大小写忽略大小写区别

-w, --word-regexp force PATTERN to match only whole words

-w,--word regexp强制模式只匹配整个单词

-x, --line-regexp force PATTERN to match only whole lines

-x,--行regexp强制模式仅匹配整行

-z, --null-data a data line ends in 0 byte, not newline

-z,--空数据数据数据行以0字节结尾,而不是换行符



Miscellaneous:

其他:

-s, --no-messages suppress error messages

-s,--无消息禁止显示错误消息

-v, --invert-match select non-matching lines

-v,--反转匹配选择不匹配的行

-V, --version display version information and exit

-V,-版本显示版本信息和退出

--help display this help text and exit

-帮助显示此帮助文本并退出



Output control:

输出控制:

-m, --max-count=NUM stop after NUM matches

-m,--max count=NUM匹配后的NUM stop

-b, --byte-offset print the byte offset with output lines

-b,--字节偏移量打印带输出行的字节偏移量

-n, --line-number print line number with output lines

-n,--行号打印带输出行的行号

--line-buffered flush output on every line

--每行上的行缓冲刷新输出

-H, --with-filename print the file name for each match

-H,--使用文件名打印每个匹配项的文件名

-h, --no-filename suppress the file name prefix on output

-h,--没有文件名在输出时抑制文件名前缀

--label=LABEL use LABEL as the standard input file name prefix

--label=label使用label作为标准输入文件名前缀

-o, --only-matching show only the part of a line matching PATTERN

-o,--仅匹配仅显示行匹配模式的部分

-q, --quiet, --silent suppress all normal output

-q,--静音,--静音抑制所有正常输出

--binary-files=TYPE assume that binary files are TYPE;

--binary files=TYPE假定二进制文件是TYPE;

TYPE is 'binary', 'text', or 'without-match'

类型为“binary”、“text”或“without match”

-a, --text equivalent to --binary-files=text

-a,--text等价于--binary files=text

-I equivalent to --binary-files=without-match

-我等价于--binary files=不匹配

-d, --directories=ACTION how to handle directories;

-d,--directories=如何处理目录的操作;

ACTION is 'read', 'recurse', or 'skip'

操作为“read”、“recurse”或“skip”

-D, --devices=ACTION how to handle devices, FIFOs and sockets;

-D,--设备=操作如何处理设备、FIFO和插槽;

ACTION is 'read' or 'skip'

操作为“读取”或“跳过”

-r, --recursive like --directories=recurse

-r,--递归类--目录=递归

-R, --dereference-recursive likewise, but follow all symlinks

-R,--同样地取消递归引用,但遵循所有符号链接

--include=FILE_PATTERN search only files that match FILE_PATTERN

--include=FILE_PATTERN仅搜索与FILE_PATTERN匹配的文件

--exclude=FILE_PATTERN skip files and directories matching FILE_PATTERN

--exclude=文件模式跳过与文件模式匹配的文件和目录

--exclude-from=FILE skip files matching any file pattern from FILE

--exclude from=文件跳过与文件中的任何文件模式匹配的文件

--exclude-dir=PATTERN directories that match PATTERN will be skipped.

--exclude dir=将跳过与模式匹配的模式目录。

-L, --files-without-match print only names of FILEs containing no match

-L,--不匹配的文件只打印不匹配的文件名

-l, --files-with-matches print only names of FILEs containing matches

-l,--具有匹配项的文件仅打印包含匹配项的文件的名称

-c, --count print only a count of matching lines per FILE

-c,--count只打印每个文件的匹配行数

-T, --initial-tab make tabs line up (if needed)

-T,--初始制表符使制表符对齐(如果需要)

-Z, --null print 0 byte after FILE name

-Z,--空打印文件名后0字节



Context control:

上下文控件:

-B, --before-context=NUM print NUM lines of leading context

-B,--before context=NUM打印前导上下文的NUM行

-A, --after-context=NUM print NUM lines of trailing context

-A,--after context=NUM打印尾部context的NUM行

-C, --context=NUM print NUM lines of output context

-C,--context=NUM打印输出上下文的NUM行

-NUM same as --context=NUM

-NUM与--context=NUM相同

--color[=WHEN],

--颜色[=时间],

--colour[=WHEN] use markers to highlight the matching strings;

--colour[=WHEN]使用标记突出显示匹配的字符串;

WHEN is 'always', 'never', or 'auto'

何时是“总是”、“从不”或“自动”

-U, --binary do not strip CR characters at EOL (MSDOS/Windows)

-U,--二进制不在下线处删除CR字符(MSDOS/Windows)

-u, --unix-byte-offsets report offsets as if CRs were not there

-u,--unix字节偏移量报告偏移量,就好像CRs不存在一样

(MSDOS/Windows)

(MSDOS/Windows)



'egrep' means 'grep -E'. 'fgrep' means 'grep -F'.

“E grep”的意思是“grep-E”“F grep”的意思是“grep-F”。

Direct invocation as either 'egrep' or 'fgrep' is deprecated.

不赞成直接调用“egrep”或“fgrep”。

When FILE is -, read standard input. With no FILE, read . if a command-line

当文件为-时,读取标准输入。没有文件,读。如果命令行

-r is given, - otherwise. If fewer than two FILEs are given, assume -h.

-r是给定的,-否则。如果给定的文件少于两个,则假定-h。

Exit status is 0 if any line is selected, 1 otherwise;

如果选择任何行,退出状态为0,否则为1;

if any error occurs and -q is not given, the exit status is 2.

如果发生任何错误,并且没有给出-Q,则退出状态为2。



Report bugs to: bug-grep@gnu.org

报告错误至:bug-grep@gnu.org

GNU grep home page: <http://www.gnu.org/software/grep/>

GNU grep主页:<http://www.GNU.org/software/grep/>

General help using GNU software: <http://www.gnu.org/gethelp/>

使用GNU软件的一般帮助:<http://www.GNU.org/gethelp/>

TOP

返回列表