マッチしたファイル名を取得する - PowerShell

マッチしたファイル名を取得する

 PS> rg -l foo
 
 1.txt
 2.txt
 a\3.txt

カンマ区切りのStringで取り出す

 PS> (rg -l -0 foo) -Replace "\0",","
 
 1.txt,2.txt,a\3.txt,

配列で取り出す

 PS> $array = (rg -l -0 foo) -Split "\0",","
 PS> $array[1]
 
 2.txt

参考

https://github.com/BurntSushi/ripgrep/blob/master/doc/rg.1.txt.tpl


トップ   編集 凍結 差分 バックアップ 添付 複製 名前変更 リロード   新規 一覧 検索 最終更新   ヘルプ   最終更新のRSS

Last-modified: 2019-04-16 (火) 12:40:21