Search code examples
batch-filecommand-linecmdcommand-promptfindstr

Findstr to output children and parent


I am trying to organize my xml/kml file using command line. I can use findstr "STRING" file.txt to find the data I only need but can't seem to get the rest of the children from its parent. The kml file is structured like

<Placemark>
<name></name>
<description> [The sring data I need] </description>
<Point><coordinates></coordinates></Point>
</Placemark>

When I run the findstr I only get the description data and need to get all the above, any ideas?


Solution

  • grep -A3 -B2 "String" file.txt worked for me thanks @zb226