Grep does not work
Hello,
I am trying to search for a string in some xml files. For instance, I use grep like the following. Quote:
Is it something that I do wrong? Thank you, manolakis. |
The XML element <name> can be spread over one or more lines, among other problems. So plain grep is not the right tool for XML.
There are a lot of tools that work with Xpaths. None of them, that I know of, really work like grep not even xgrep. Hopefully I am wrong about that. Playing with xpath and find you can get several variations that approximate what you can get from grep. But that gets quite complicated. If you want just the list of file names then xml_grep can do the job: Code:
xml_grep --files '//name' ./*.xml |
if you really want to look for the given string you may try grep -f (see man page about that), but actually xmls cannot be handled easily without real xml parser.
|
All times are GMT -5. The time now is 10:54 PM. |