shell - Searching Pattern after a specific pattern in bash script -


i have search 100 files of following format.

<dependencies> <a1 build="true"> <a2 build="false"> <a3 build="false"> <deployments> <a1 build="false"> <a2 build="true"> <a3 build="false"> 

i have find files have atleast 1 deployment build="true". problem how should start search after string deployment dependencies build="true" doesnot come search.

awk 'fnr == 0 { dep = 0; }      /<deployments>/ { dep = 1; }      /build="true"/ && dep { print filename; nextfile; }' file1 file2 ... 

Comments

Popular posts from this blog

python - matpltolib navigation toolbar edit curves and parameters line color automatically changes issue -

node.js - Nodejs javascript implementation of PBEWithMD5AndTripleDES/CBC/PKCS5Padding -