Using Bash,
File:
<?xml version="1.0" encoding="UTF-8"?> <blah> <blah1 path="er" name="andy" remote="origin" branch="master" tag="true" /> <blah1 path="er/er1" name="Roger" remote="origin" branch="childbranch" tag="true" /> <blah1 path="er/er2" name="Steven" remote="origin" branch="master" tag="true" /> </blah>
I have tried the following:
grep -i 'name="andy" remote="origin" branch=".*\"' <filename>
But it returns the whole line:
<blah1 path="er" name="andy" remote="origin" branch="master" tag="true" />
I would like to match the line based on the following:
name="andy"
I just want it to return:
master