By arunraj
Use the following shell script to get a particular tag content from html, jsp or xml file in unix system.
tagContent.sh
#!/bin/sh
for f in `ls *.$1`
do
m=`cat $f | sed -n "s/<$2>\(.*\)<\/$2>/\1/p"`;
echo ${f} ${m}
done
for f in `ls *.$1`
do
m=`cat $f | sed -n "s/<$2>\(.*\)<\/$2>/\1/p"`;
echo ${f} ${m}
done
To execute the above shell script use the following command
sh tagContent.sh <file-extension> <tag-name>
example: sh tagContent.sh jsp title
example: sh tagContent.sh jsp title
Execution of above command will result in listing the jsp files with the content of title tag.