• [灯火阑珊] 关于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
    --------蓝天上的云_转载请注明出处.
  • 相关阅读:
    Oracle -- Create Tablespace
    EntityFramework-DBFirst-重新生成后写的验证消失(解决办法)
    UILocalNotification本地通知
    属性观察者willSet与didSet
    常用后台frame框架
    Windows常用CMD命令
    常用的格式符与转义字符
    Windows操作系统常用快捷键
    Mac操作系统常用快捷键
    srp render queue 失效
  • 原文地址:https://www.cnblogs.com/yucloud/p/10708504.html
Copyright © 2020-2023  润新知