I am using elinks in a bash script and trying to pull out a particular hyperlink on a webpage. elinks displays hyperlinks in an enumerated manner, and I know which number link I want. For example, let say I want link number 2 on the website www.example.com
I have tried mylink=`elinks -dump http://example.com
| grep http | grep '2.'` to set a variable $mylink as the link I want, but unfortunately that leads to 2, 12, 22, 32, etc all being picked up as well. I only want 2!
So my question is, does elinks have an option (I couldn't see one in the man pages) where one can specify to output only link number 2 in the dump?