PowerShell Select-string as grep in linux
1. grep -A2 -B2
PS C:\work> select-string "BEGIN DSSHAREDCONTAINER" -context 1 all.dsx
all.dsx:2495323:END DSJOB
> all.dsx:2495324:BEGIN DSSHAREDCONTAINER
all.dsx:2495325: Identifier "CONT010"
all.dsx:2513203:END DSSHAREDCONTAINER
> all.dsx:2513204:BEGIN DSSHAREDCONTAINER
all.dsx:2513205: Identifier "CONT020"
さらに絞り込む
PS C:\work> select-string "BEGIN DSSHAREDCONTAINER" -context 1 all.dsx | out-string -stream | select-string "Identifier"
all.dsx:2495325: Identifier "CONT010"
all.dsx:2513205: Identifier "CONT020"
2. grep "警告" a.log | wc -l
PS C:\work> cat a.log | Select-String "警告" | Measure-Object -Line
Lines Words Characters Property
----- ----- ---------- --------
11664
コメント
コメントを投稿