0

I have an html table in which the first row is the title and the next rows represent the body of the table. I want to extract the values from the 3'rd column of each row. How can I proceed?

0

1 Answer 1

1

Try the below awk command,

awk 'NR>1{print $3}' file

This prints the value of third column except the one in the header.

Update:

awk -v RS='</tr>' -v F='<td>' '{$3=gsub(/<[^<>]*>/,"",$3);print $3}' file
Sign up to request clarification or add additional context in comments.

4 Comments

No. It doesn't work. I think a delimiter (<td>) should be used in this case.
could you provide an example along with expected output?
awk -v RS='</tr>' -v F='<td>' '{print $3}' - this will print <td>value</td>. How can I extract the value from here?
awk -v RS='</tr>' -v F='<td>' '{$3=gsub(/<[^<>]*>/,"",$3);print $3}' file

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.