tr_tagcontentgrep -- grep for a xml/sgml/html tag
tr_tagcontentgrep [-hl] regexp-pattern [file ...]
tr_tagcontentgrep opens all files provided on the command line and searches for the given pattern in the tags. The search is not case sensitive.
tr_tagcontentgrep is part of the HTML::TagReader package but is an example that you can also do 'reading by tag' without HTML::TagReader. tr_tagcontentgrep uses plain perl and sets the $/ variable. Working without HTML::TagReader causes however problems when working with faulty html code where single '<'-characters appear somewhere in the text.
All space in the tags is reduced to max. one space. You can search for "a href" even if the original tag had multiple spaces between "a" and "href".
-h this help
-l list filename and line number
tr_tagcontentgrep -l img file.html
would e.g print something like:
index.html:53: <IMG src="../images/transpix.gif" alt=""> index.html:257: <IMG SRC="../Logo.gif" width=128 height=53>
tr_tagcontentgrep is part of the HTML::TagReader package and was written by Guido Socher [guido(at)linuxfocus.org]
To install HTML::TagReader, copy and paste the appropriate command in to your terminal.
cpanm
cpanm HTML::TagReader
CPAN shell
perl -MCPAN -e shell install HTML::TagReader
For more information on module installation, please visit the detailed CPAN module installation guide.