Here is exam XML..
<?xml version="1.0" encoding="UTF-8"?>
<books>
<book>
<title>a book</title>
<writer>Tom</writer>
</book>
<book>
<title>b book</title>
<writer>John</writer>
</book>
<book>
<title>c book</title>
<writer>Tom</writer>
</book>
</books>
I want to find a list of this writer is Tom. So my script is
[xml]$books = Get-Content C:\Users\Administrator\Documents\books.xml
$books.book| %{$_.book.writer -match 'Tom'}
But this script show only writer...
writer
Tom
Tom
I want to see like this
title writer
a book Tom
c book Tom
help me plz.