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

c# - How to get the current UAC mode -

postgresql - Lazarus + Postgres: incomplete startup packet -

javascript - Ajax jqXHR.status==0 fix error -