Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I have a bash shell script that I use to upload a set of HTML files to a web server. The script makes various changes to the code before it uploads it.

One thing I'd like to do is strip the HTML code of comments and excess white space.

Is there a command I can use to do that within the bash script?

share|improve this question
    
In case you don't get the answer here because it isn't strictly Ubuntu-related, you may consider asking over at unix.stackexchange.com. –  user25656 Mar 29 '12 at 7:41

1 Answer 1

up vote 1 down vote accepted

Take a look at tidy. It might help you achieve the results you'd like to have. Version 20091223cvs-1 is available from the repositories.

Tidy is a:

HTML syntax checker and reformatter Corrects markup in a way compliant with the latest standards, and optimal for the popular browsers. [...]

Homepage: http://tidy.sourceforge.net/

share|improve this answer
    
This is a viable solution so I marked it correct, but actually, I ended up using HTMLcompressor instead: code.google.com/p/htmlcompressor . Answer was found on Stack Overflow: stackoverflow.com/a/1388596/184108 –  Questioner Apr 8 '12 at 6:55
    
Thank you for following through! That tool will probably better suit to your needs. Also the compressor's page is a very interesting read. –  lgarzo Apr 8 '12 at 19:35

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.