This might work for you (GNU sed):
sed '/^/!d;/| /\n/2;s/.*\n\(\S*\).*/\1/' file
Explanation:
- Focus on lines between start
and end tags. /^/!d
- Store
lines in the hold space (HS). /
- Delete all lines in range except the last.
/^<\/tr/!d
- Swap to HS.
x
- Delete all newlines.
s/\n//g
- Replace 2nd
with a newline. s//\n/2
- Delete all text in the HS except for the first non-space field following the inserted newline and print.
s/.*\n\(\S*\).*/\1/
| | | | |