I am using sed to read the .css file name (after "href=") from an html file. The command is follow:
cssFiles=$(echo "$BODY" | sed -rn 's/<link\s.*href=\W(.*.css).*/\1/p')
But, it does not works correctly. Below, sample input, output and expected output is given. Where am I wrong?
Sample input:
<link href="/css/default.css" rel="stylesheet" type="text/css" />
<link rel="stylesheet" type="text/css" href="js/flexslider/flexslider.css">
Sample output:
/css/default.css" rel="stylesheet" type="text/css
js/flexslider/flexslider.css
Expected output:
/css/default.css
js/flexslider/flexslider.css