Sample Header Ad - 728x90

Find XML file with specific path

4 votes
2 answers
1296 views
I'm working with XML files, each of which could be dozens of lines long. There are literally hundreds of these files, all over a directory structure. Yes, it is Magento. I need to find the file that has the ` element. A ` tag could be defined under other tags, so **I need to search for the full path** not just the end tag or tags. There could be dozens of lines between each tag, and other tags between them: ... 50 lines .... ... 50 lines .... Vital information here **What is the elegant, \*nix way of searching for the file that defines ``?** I'm currently on an up-to-date Debian-derived distro. This is my current solution, which is far from eloquent: $ grep -rA 100 foo * | grep -A 100 bar | grep -A 100 boom | grep bang | grep -E 'foo|bar|boom|bang'
Asked by dotancohen (16493 rep)
Aug 1, 2021, 11:53 AM
Last activity: Aug 1, 2021, 06:27 PM