What command should I be using to extract the text from within the following html code which sits in a "test.html" file containing : "<span id="imAnID">extractme</span>
" ?
The file will be larger so I need to point grep or sed to an id and then tell it to extract only the text from the tag having this ID. Assuming I run the terminal from the directory where the file resides, I am doing this:
cat test.html | sed -n 's/.*<span id="imAnID">\(.*\)<\/span>.*/\1/p'
What am I doing wrong? I get an empty output... Not opposed to using grep for this if it's easier.