Board logo

标题: [文本处理] [已解决]批处理命令findstr怎样查找包含特殊字符的文本? [打印本页]

作者: 踏沙行    时间: 2018-8-5 11:21     标题: [已解决]批处理命令findstr怎样查找包含特殊字符的文本?

本帖最后由 踏沙行 于 2018-8-6 07:00 编辑

已知 h:\a.txt 内容如下:
  1. pro
  2. epro - cssf
  3. process
  4. pro
  5. pro - css
  6. fprocess - css
  7. process -css
  8. process - cssvd
  9. fe - css
  10. per
  11. pans
  12. alsk - css
  13. slfkj  - css
复制代码
需求:匹配包含 pro,后面还有 - css 的行,也就是第2,5-8行
请问用findstr怎么实现?
作者: Batcher    时间: 2018-8-5 11:43

  1. findstr "pro.*css" 1.txt
复制代码
http://bbs.bathome.net/thread-24-1-1.html
这个教程还没有看完?
作者: 踏沙行    时间: 2018-8-5 12:10

回复 2# Batcher
果然,非常感谢。
这个帖子看了,且收录在笔记中了,应该是我没看认真吧。
作者: Batcher    时间: 2018-8-6 16:49

空格pro开头的行

C:\Test>findstr /b /c:" pro" 1.txt
pro
process -css
作者: 踏沙行    时间: 2018-8-6 17:36

回复 4# Batcher

正是,非常感谢




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