I know, don’t parse using curl, grep and sed. But I am looking for an easy approach, not a very safe one.
So I get an HTML file with curl, from which I need a value of a certain attribute from a tag. I use grep to get me the line where it says token. This only occurs once.
This gives me a whole div:
<div class="userlinks">
<span class="arrow flleft profilesettings">settings</span>
<form class="logoutform" method="post" action="/logout">
<input class="logoutbtn arrow flright" type="submit" value="Log out">
<input type="hidden" name="ltoken" value="a5fc8828a42277538f1352cf9ea27a71">
</form>
</div>
How can I get just the value attribute (e.g. “a5fc8828a42277538f1352cf9ea27a71”)?
There’s no need to grep: