I have a text file that looks like this:
landlord: John Smith
has:
house: 0
flat: 5
available: 1
cheap: 0
quality: 1
landlord: Will Hall
has:
house: 3
flat: 4
available: 1
cheap: 1
quality: 0
landlord: Marry Moe
has:
house: 0
flat: 2
available: 1
cheap: 1
quality: 0
All I am interested in is landlord
and available
lines. How to grep
the available: 1
line by landlord
?
I mean cat filename | grep -i 'landlord: John Smith'
and then check if available
is 1
or 0
?