I am trying to figure out how to use bash to print a certain line in a few XML files. These files are located in several folders. The line I need to print is an exact XML tag called
<name></name>.
My objectives:
- search through folders
- print folder location on one line
- print file name on second line
-
print what is between
I only need the name and not the full path and I do need it to add to a .txt file called whatever. Ive tried with bash but Im stuck on this one.
EDIT:
I also forgot to mention that this is a piece being added to some other shell script so Im unsure if I can get grep to work within it.
Using grep and a regular expression recursively on a directory shows you the file names (including the path) with the tag in it: