Grepping for a fixture ID and printing the 2 teams involved

Hello, I have a fixture file which looks something like the attached.

At the top of each file is a list of teams who are involved in at least one of the fixture below.

I currently have a grep which searches in each clients fixture file to confirm whether or not they have received a specific fixture ID. What I would like to do is be able to grep for a fixture ID and print an output something like;

Fixture ID: xxxxxxx
Team1 vs Team2

Clients;
client1
client2
client3
etc

At the moment all I get is;

Fixture ID: xxxxxxx

Clients;
client1
client2
client3
etc

What would be the best way of printing the related teams to the page too?
Fixture file;
 
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE Fixtures SYSTEM "Fixtures.dtd">
<Fixtures sport="Soccer">
  <Teams>
    <Team id="65" name="Swansea" />
   <Team id="41" name="Watford" />
  <Fixture id="3072313" competitionId="301" stageNumber="1" roundNumber="5" leg="1" date="20081111" time="1945+0000" venue="Liberty Stadium" country="England
">
    <Participant teamId="65" />
    <Participant teamId="41" />
  </Fixture>
</Fixtures>
 
Script which runs the grep;
 
#!/bin/bash
echo
read -p "Enter the fixture id:" id
 
echo "These clients take fixture " $id
grep $id /usr/local/production/soccermatchplus/distributor/clients/*/out/fixtures.xml | awk -F/ '{print $8}'

Open in new window

LVL 7
dann47Asked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

mikelfritzCommented:
you could try adding this just above your grep:

file=`grep -l $id /usr/local/production/soccermatchplus/distributor/clients/*/out/fixtures.xml`
cat $file | grep name | tail -2l | awk -F\" '{ print $4 }'
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Shell Scripting

From novice to tech pro — start learning today.