Thursday 15 April 2010

url - Bash: unusual line break -


I've coded a small script in bash, which reads some HTML and should print href of a link : #! / Bin / bash link = $ (echo $ source | sed -ne's # ^. * & Lt; a href = "[[^"] * \) ". * $ # 1 #p ') If [" $ (Resonant "$ link" | grep '/ fonts / list / style') "] Then" http: //www.domain.com$link/10000 "" / Pre>

var source My example is:

  & lt; Li & gt; & Lt; Span & gt; 19 & lt; / Span & gt; & Lt; A href = "/ fonts / list / style / home word" & gt; Link text & lt; / A & gt; & Lt; / Li & gt;   

Problem: do not print the script

  http: //www.domain .com / fonts / list / style / home words / 1000   

Prints instead

  http://www.domain.com/fonts/list / style / home word / 1000   

How can I save this line from breaking?

You " to .. :

To escape from, it works for me:

  #! / Bin / bash s ICEEELA; Li .a.tk  19    

Echo the output

  http://www.domain.com/fonts/list/style/home The word / 10000    

No comments:

Post a Comment