Home > Blockchain >  how to print certain row from specific file name that multiple appears under subdirectories
how to print certain row from specific file name that multiple appears under subdirectories

Time:01-21

I got following file system

dir1/subDir1/index.html
dir1/subDir2/index.html
dir1/subDir3/index.html

index.hml contains tag [some text]

I want to print the tag row from all index.html instances Something like this:

dir1/subDir1/index.html -> <name>[some text]</name>
dir1/subDir2/index.html -> <name>[some text]</name>
dir1/subDir3/index.html -> <name>[some text]</name>

Currently I use cat */index.html |grep "name"

But I am getting only the tag list without subdirectories referral

Thanks

CodePudding user response:

If you don't give grep filenames he is not going to print them. So give it.

grep "name" */index.html
  •  Tags:  
  • Related