zoukankan      html  css  js  c++  java
  • findstr中的空格

    findstr is a useful command in bat file.

     

    for instances:

     

    findstr /NI ^error.*: %DEBUG_LOG% 1>nul 2>&1

     

    It matches error info via regular expression, if matched, build system will thought the build encountered  a error, but sometimes, some invalid 'error' words will also be matched:

     

     Invalid Errors:

    1)      \Constants\ErrorID.cs                    a filename contains 'error' word.

    2)      /errorreport:prompt                      a parameter contains 'error' word.

     

    Valid Errors:

    1)      CSC : error CS2001: Source file user.cs is not exist.

    2)      test.cs(25,20): error CS1928: 'User' does not contain a definition for 'FindUser'

     

     

    After the command be changed to below, just match the valid errors and ignore invalid errors

    findstr /NI /C:": error " %DEBUG_LOG% 1>nul 2>&1

    why we need to use /C?

    Use spaces to separate multiple search strings unless the argument is prefixed
    with /C.  For example, 'FINDSTR "hello there" x.y' searches for "hello" or
    "there" in file x.y.  'FINDSTR /C:"hello there" x.y' searches for
    "hello there" in file x.y.

  • 相关阅读:
    CSS笔记(十)position属性与定位
    CSS笔记(九)轮廓
    前端需要学习算法吗 算法面的意义 职业规划
    Web前端笔试整理10
    Web前端笔试整理9
    Web前端笔试整理8
    Web前端笔试整理7
    Web前端笔试整理6
    JS 图片延迟加载/懒加载
    JS 同步与异步编程
  • 原文地址:https://www.cnblogs.com/DataFlow/p/findstr.html
Copyright © 2011-2022 走看看