# Online Bash Shell.
# Code, Compile, Run and Debug Bash script online.
# Write your code in this editor and press "Run" button to execute it.
cat > /dev/shm/ex01.html <<++++++++++
<html><title>Some report 01 2021 4</title><body background=White;>
<table border=1 width=90% align=center bgcolor=#f7f7e7>
<tr><td width=80%>
(02) some text
</td><td>
541
</td></tr>
<tr><td>
(03) some text
</td><td>
541
</td></tr>
<tr><td>
(04) some text
</td><td>
5039,76
</td></tr>
<tr><td>
(05) some text
</td><td>
4925
</td></tr>
<tr><td>
(06) some text
</td><td>
5039,76
</td></tr>
<tr><td>
(09) some text
</td><td>
320
</td></tr>
<tr><td>
(10) some text
</td><td>
385
</td></tr>
<tr><td>
(11) some text
</td><td>
82
</td></tr>
</table>
</body><html>
++++++++++
## #1
echo ======= 1
sed '/html/d;/title/d;/body/d;/table/d' /dev/shm/ex01.html
## #2
echo ======= 2
sed '/html/d;/title/d;/body/d;/table/d
:a;N;$!ba' /dev/shm/ex01.html
## #3
echo ======= 3
echo Convert /dev/shm/ex01.html to CSV
sed '/title/d
:a;N;$!ba
s/ \{2,\}//g
s#\s*</td>\s*</tr>\s*<tr>\s*<td>\s*#\n#g
s#\s*</td>\s*<td>\s*#;#g
s/<[^>]\+>//g
s/\n\{2,\}//g' /dev/shm/ex01.html