zoukankan      html  css  js  c++  java
  • [灯火阑珊] 关于cmd命令里的findstr匹配多个关键词

    no

    raining now

    go to school and play with code 你.

    findstr "<go  code>"

    这样就能匹配输出包含go到code的文本了

    看起来丑,其实也就是斜线加尖括号   (转义而已)

    echo "go to school and play with code 你." | findstr "<go code>"
    结果: "go to school and play with code 你."

    但是这样也行,我就懵了

    echo "go to school and play with code 你." | findstr "<code go>"
    "go to school and play with code 你."

     还有这样

    echo "go to school and play with code 你." | findstr "<code> <go>"
    "go to school and play with code 你."

    而这最后这种情况有个强大的bug,

    它有时搭配dir时只输出包含中文的内容,我的是win10预览版,正式版怎么样不清楚,气死我了,难怪windows在命令行领域干不过Linux

    出bug的命令[一脸懵逼]

     

    所以这玩意到底是怎么用的

    附上从不知道哪里复制过来的,侵权请联系我

    利用元字符查找。
    <xyz    字位置: 字的开始
    xyz>    字位置: 字的结束
    1. @echo off
    2. findstr "<1080> <443> <80>" 1.txt>>2.txt
    3. echo 处理完成,按任意键退出
    4. pause>nul
    --------蓝天上的云_转载请注明出处.
  • 相关阅读:
    计算长度的方法
    自动装箱和拆箱
    基本数据包装类
    Date类
    文档参数解析
    权限修饰符
    IO流
    ArrayList集合类
    对象数组
    二维数组
  • 原文地址:https://www.cnblogs.com/yucloud/p/10708504.html
Copyright © 2011-2022 走看看