Board logo

标题: [文本处理] 批处理如何截取字符串到另外一个文本? [打印本页]

作者: 帝尊    时间: 2022-8-26 16:09     标题: 批处理如何截取字符串到另外一个文本?

例如有一个log文件的内容是:
  1. <head>
  2. <meta http-equiv="Content-Type" content="text/html; charset=gbk" />
  3. <title> 批处理之家 批处理_BAT脚本_PowerShell_VBS_CMD_DOS_Perl_Python - Powered by Discuz!</title>
  4. <meta name="keywords" content="批处理,批处理命令,批处理教程,BAT,BAT脚本,CMD,DOS,VBS,VBScript,JScript,JavaScript,Perl,Python,PowerShell" />
  5. <meta name="description" content=" 批处理之家 批处理之家是中国最实用的批处理论坛.由批处理,DOS,VBS,JScript,JavaScript,Perl,Python,PowerShell等版块组成.涵盖批处理删除文件,DOS命令大全,CMD命令大全,清理系统垃圾bat,VBS整人代码破解等实用信息.众多脚本高手帮助你及时解决各种问题. - Discuz! Board" />
  6. <meta name="generator" content="Discuz! 7.2" />
  7. <meta name="author" content="Discuz! Team and Comsenz UI Team" />
  8. <meta name="copyright" content="2001-2009 Comsenz Inc." />
  9. <meta name="MSSmartTagsPreventParsing" content="True" />
  10. <meta http-equiv="MSThemeCompatible" content="Yes" />
  11. <meta http-equiv="x-ua-compatible" content="ie=7" />
  12. <link rel="archives" title="批处理之家" href="http://www.bathome.net/archiver/" />
  13. <link rel="stylesheet" type="text/css" href="forumdata/cache/style_1_common.css?VK8" /><link rel="stylesheet" type="text/css" href="forumdata/cache/scriptstyle_1_search.css?VK8" />
  14. <script type="text/javascript">var STYLEID = '1', IMGDIR = 'images/default', VERHASH = 'VK8', charset = 'gbk', discuz_uid = 72104, cookiedomain = '', cookiepath = '/', attackevasive = '0', disallowfloat = 'newthread|reply|viewvote|tradeorder|activity|debate', creditnotice = '', gid = 0, fid = parseInt('0'), tid = parseInt('0')</script>
  15. <script src="forumdata/cache/common.js?VK8" type="text/javascript"></script>
  16. </head>
复制代码
是否可以截取
  1. <meta name="author" content="Discuz! Team and Comsenz UI Team" />
  2. <meta name="copyright" content="2001-2009 Comsenz Inc." />
  3. <meta name="MSSmartTagsPreventParsing" content="True" />
复制代码
这三条内容到另外一个文本文档内?
可以只用批处理吗?不用PowerShell。用PowerShell会导致乱码。
作者: hfxiang    时间: 2022-8-26 16:39

findstr "MSSmartTagsPreventParsing author copyright" log.log




欢迎光临 批处理之家 (http://bbs.bathome.net/) Powered by Discuz! 7.2