Print line if contains word

后端 未结 2 1713
再見小時候
再見小時候 2021-01-26 17:07

I am trying to make a batch file to execute a few things for me.
Now I do understand a few programming languages, but I haven\'t done much in batch file programming yet.

2条回答
  •  礼貌的吻别
    2021-01-26 17:52

    If you are new to scripting, I would avoid batch (shell script) and use PowerShell. PowerShell is far more powerful and flexible.

    get-content 'file.txt' | select-string 'node:(\s+)' | foreach-object {
      $_.Matches[0].Groups[1].Value
    }
    

    This command would output the first substring match (from inside parentheses in regular expression) from each line.

提交回复
热议问题