I have an html page that has data like so:
<td><a href="test-2025-03-24_17-05.log">test-2025-03-24_17-05.log</a></td>
<td><a href="PASS_report_test_2025-03-24_17h07m10.html">PASS_report_test_2025-03-24_17h07m10.html</a></td>
<td><a href="TESTS-test_01.xml">TESTS-test_01.xml</a></td>
<td><a href="TESTS-test_02.xml">TESTS-test_02.xml</a></td>
I would like to extract the link 'PASS_report_test_2025-03-24_17h07m10.html'. The date and timestamp of the link changes depending on the day that the tests are run. However, the prefix substring 'PASS_report_' does not.
Expected output:
PASS_report_test_2025-03-24_17h07m10.html
I tried the solution
sed -n 's/.*href="\([^"]*\).*/\1/p' file
suggested here. But it didn't work i.e. Printing out the values of the variable that contained the links after parsing resulted null.
Any suggestions on how to extract the link?
Thank you in advance.
But it didn't work.doesn't tell us why/how it didn't work; did it generate an error message? did it generate no output? did it generate the wrong output? something else? please update the question with details on what you mean byBut it didn't work.lynx -dump -listonly -nonumbers file.html | sed 's|.*/||'