.texファイルのリストを見つけるには、Find-grepを使用しますか?

.texファイルのリストを見つけるには、Find-grepを使用しますか?

document.texファイルのリストを取得し、用語を使用してこのファイルを特定したいと思います。gastric

\subimport{}{1.2_protocal_answers.tex}
\subimport{}{2_protocol_answers.tex}
  • 1.2_protocal_answers.texコンテンツ:this is a gastric juice lorem content
  • 2_protocol_answers.texコンテンツ:this is a second gastric\n test file

私の.pdf出力は破損していますが、資料の内容を検索する必要があります。私のディレクトリが大きすぎて誰もがこれを行うことはできません。 Geanyのを使用して行うことができますFind in Files。ファイルからインポートされたファイルに対して関連検索を実行したいと思います。努力する

  • .tex ドキュメントのファイルリストの疑似コードを取得できません。

    find ./document.tex -type f -exec \
        grep -E '\subimport{[A-Za-z1-9_-]*} {} \; 
    # TODO search the list of files with the word `gastric`
    
  • IDEの方法はありますか?私は内部的に私が好きなIDEを使用しているので、ここのアプローチが最も適しているとgrep思います。find-grep

システム:Ubuntu 16.04、64ビット
grep:grep(GNU grep)2.25
find:find(GNU findutils)4.7.0-git
ハードウェア:Macbook Air 2013-mid
Linuxカーネル:4.6

ベストアンサー1

ユーザーのニーズに応じて編集:

   cat document.tex | cut -d'{' -f3 | cut -d'}' -f1 | while read file
         grep -i 'gastric' "$file" &>/dev/null && echo "$file contains gastric"
   done 

おすすめ記事