
txtファイルを編集したいですvideoA
。videoB
movsファイル名に名前空間が含まれている場合のみ -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.txt
videoC_v002_info.txt
.mov
test
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
同時に開く
(ファイル名にコロンが含まれていないと仮定)