Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

5
  • If <C>...</C> always in one line try grep -o '<[CD]>[^<]*</[CD]>' Commented Aug 24, 2015 at 8:40
  • A,B,..Z are just to replace the names of the actual parameter. what should be done in this case Commented Aug 24, 2015 at 8:42
  • grep -o '<\(parameterC\|parameterD\)>[^<]*</\1>' Commented Aug 24, 2015 at 8:46
  • 1
    I really wouldn't suggest using grep - XML is not a thing that's easily greppable, thanks to whitespace reformatting, tag nesting and unary tags. Not to mention handing broken XML appropriately. (e.g. you should at least detect if tags aren't closed). Commented Aug 28, 2015 at 13:05
  • well, as part of some troubleshooting, there is a need to understand some phenomena for a records which contain a big amount of data but I need only part of it. I think that the best option would be to get it into Excel so that I can see it and filter the exact values which I'm looking for. Therefore I think about performing grep on the XML. Commented Aug 29, 2015 at 13:46