sed newline

November 7, 2010 at 03:36:37
Specs: Macintosh
Hi everyone,

I'd like to use the script validatehtml which returns either the given url is HTML strict or not, using http://validator.w3.org/.

sh validatehtml

#!/bin/bash
wget -q http://validator.w3.org/check?uri=$1
cat check\?uri\=$1 | sed -n '/h2/ p' | sed 's/ */ /g' | sed 's/^ //g' | sed 's/\n//' | sed 's/\(<.*>\)*\(.*\)\(<.*>\)*/\2/g'

But he doesn't want to remove the newline. Can somebody help me? The sed procedures need to be in this order because the message proceeded by h2 is sometimes only 1 line, not two.

sh genscript www.w3c.org :2 lines
sh genscript www.google.com :1 line

thanks guys!


See More: sed newline

Report •

#1
November 8, 2010 at 12:58:31
I am not exactly certain what you are trying to do. The only suggestion I have is instead of using this for a new-line:

\n

replace it with this and see if it helps:

\r

Otherwise, if you need more help, I suggest you post a sample data file and explain what you are trying to do.


Report •


Ask Question