I want to grep through all my HTML files and see if I have any bad tags there,
example <br> , <hr> and so on, that is the I want to see what tags are not closed in the HTML file.
for htmlFile in `ls -f *.html ` ; do
        if `cat $htmlFile | grep -inE "\<br\>"` ; then
           echo "In file $htmlFile there are errors on the following lines: "  >> ~/Desktop/$1_errors.txt
           cat $htmlFile | grep -in "<br>"| cut -d ":" -f1 >> ~/Desktop/$1_errors.txt
           echo "----------------------------------------" >> ~/Desktop/$1_errors.txt
       fi
done
But I get an error, I am suspect its my regex.
./script.sh: line 14: 10:<BR: command not found
That is one of the error I get :)
lsin this case.shopt -s nullglobbut I dont know how to undo shoptforloops withls(and avoid parsing ls in general) 3) Don'tcat file | grep, justgrep file.</br>is not needed in the latter and there are various other tags that don't need closing tags. How would you deal with nested tags? The whole thing is just way too complex for regular expressions.