Christopher Juckins

SysAdmin Tips, Tricks and other Software Tools

User Tools

Site Tools


clean_up_html_markup_with_tidy_and_perl

Download and install Tidy.

For help, do:

tidy -help

To clean up HTML by creating indented code, wrapping text at column #500, converting HTML to XHTML, and modify the existing file in place, do the following:

tidy -i -w 500 -asxml -m <filename>

Make sure to make a backup copy of the file first.

Now remove blank lines from the resulting cleaned-up code using perl:

perl -pi -e "s/^\n//" <filename>
clean_up_html_markup_with_tidy_and_perl.txt · Last modified: 2008/12/05 21:41 by juckins