grep 検索結果を新しい vi ファイルにパイプする方法

grep 検索結果を新しい vi ファイルにパイプする方法

私はcarlist.txtを検索していくつかの項目を取り出しました。これは私にパイプでつながるとgrep -e Peugeot -e PeuGeot carlist.txt思いましたが、これは私が得たものです:grep -e Peugeot -e PeuGeot carlist.txt | vi

Vim: Warning: Input is not from a terminal
Vim: Error reading input, exiting...
Vim: preserving files...
Vim: Finished.

ベストアンサー1

"-"を引数としてviまたはvimを実行すると、標準入力から編集したいファイルが読み込まれます。したがって:

grep -e Peugeot -e PeuGeot carlist.txt | vi -

必要なことをします。

おすすめ記事