PDA

View Full Version : bash: how to add lines into a html file?



honeybear
August 27th, 2010, 04:49 PM
hello,

I have an HTML file of not containing any line feed, how can I add some to a fully non lined file content ?

" ... rea(this);"><table cellpadding="3" cellspacing="0" border="0" width="100%"><tr><td><a href="/user .."

thanks

PryGuy
August 27th, 2010, 05:00 PM
Do you want to have multiple lines? Use <br /> then.

spjackson
August 27th, 2010, 06:39 PM
I have an HTML file of not containing any line feed, how can I add some to a fully non lined file content ?

" ... rea(this);"><table cellpadding="3" cellspacing="0" border="0" width="100%"><tr><td><a href="/user .."

If it's a one-off, you could place a newline after every > like this:

sed 's/>/>\
/g' input.html > output.html
For a better solution I'd suggest using the HTML tidy program, http://tidy.sourceforge.net/ , e.g.

tidy -i -wrap 75 input.html > output.htmlThis will output nicely indented tags, wrapping text at column 75.