Search for and print only matched pattern
- by Ayman
I have some huge xml text files. I need to write a script to find and print a specific tag only. I tried sed and grep but they both return the whole line.
Using SunOS 5.x, so not all linux commands may work. grep -o is not available.
The 'xml' file is not actually one huge xml document, but each line is a separate xml document, with just a few tags, not even nested. And the structure is fairly easy, so full xml parsers is not needed, and probably would not work.
I was looking for sed, awk, or some other one liners, but could not get them to work, and they are both relatively new to me.