特定の名前パターンを見つけるときに異なる形式のファイルを一覧表示する

特定の名前パターンを見つけるときに異なる形式のファイルを一覧表示する

txtファイルを編集したいですvideoAvideoBmovsファイル名に名前空間が含まれている場合のみ -test

例えば。

videoDir
    |-videoA
        |- videoA_v001_test.mov
        |- videoA_v001_info.txt
    |-videoB
        |- videoB_v001_test.mov
        |- videoB_v001_info.txt
    |-videoC
        |- videoC_v002.mov
        |- videoC_v002_info.txt

上記で修正したかったvideoDir/videoA/videoA_v001_info.txtのですが、そのファイル名に。videoDir/videoB/videoB_v001_info.txtvideoC_v002_info.txt.movtest

find -name "*.mov" | grep -rn "test" | find -name "*.txt"出力からtxtファイルでフィルタリングすると思ったので、-、find -name "*.txt"`コマンドを考えましたが、find -name "*.mov" | grep -rn "test" does indeed lists out the 2 files that fulfills the condition (videoA and videoB). I added inまだすべてのtxtファイルを一覧表示したので間違っていました。

答え1

そしてzsh

vi ./**/*_test.mov(.s:_test.mov:_info.txt:)

答え2

あなたは次のようなものが必要です

find . -name "*.mov" -exec grep test {} + | sed -n 's/^\([^:]*\):.*$/\1/p' | xargs -d \\n -n 1 $EDITOR

一度に1つのファイルを開くために使用されます。

または

find . -name "*.mov" -exec grep test {} + | sed -n 's/^\([^:]*\):.*$/\1/p' | xargs -d \\n $EDITOR

同時に開く

(ファイル名にコロンが含まれていないと仮定)

関連情報