ファイルやディレクトリの一覧から、必要な行だけを抜き出して表示する例を考えよう。 まず、次のようなディレクトリがあったとする。 PowerShell CoreではSelect-Stringコマンドレットがgrepコマンドと似たような動きをする。 そこでSelect-Stringコマンドレットを ...
PowerShell 7.0.0-preview5ではSelect-Stringコマンドレットにもちょっとした工夫が取り込まれている。Select-Stringコマンドレットは、UNIX系のコマンドで言えばgrepコマンドに相当する機能で、指定したキーワードを含む行だけを抽出する処理を可能にしてくれる。
そんな絶望感に襲われている Linux ユーザーへ。 コマンドプロンプトの不便さを嘆く必要はありません。 Windows 標準の「PowerShell」は、実は Linux ユーザーにとっても強力な武器になるポテンシャルを秘めています。「劣化版 Bash」という誤解を捨て、今すぐ ...
Whether you are parsing logs or validating input, using regular expressions is a great way to accomplish both of these things. The problem is: regular expressions can be hard and that will only grow ...