i have this following command that gets the data from column 2:
Table example:
<table>
<tr>
<td>a</td>
<td>b</td>
<td>c</td>
<td>d</td>
<td>e</td>
</tr>
<tr>
<td>1</td>
<td>2</td>
<td>3</td>
<td>4</td>
<td>5</td>
</tr>
</table>
wget -q -O - http://www.example.com | xmllint --html --xpath "//table[@id="tableID"]//tr//td[position() = 2]//text() - 2>/dev/null
That outputs something like:
12345
how can I get all both column 1 and column 2 with ":" symbol that appends on each line?
Desired output:
a:1
b:2
c:3
d:4
e:5
Thanks in advanced!
I also asked similar question here with output example and desired output:
xpath html combine columns
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…