i have this following command that gets the data from column 2: Table example:
a | b | &Solution 1:
With xmlstarlet and awk:
wget -q -O - "http://www.example.com" | xmlstarletsel -t -v "//tr/td" -n \
| awk -F'\n' -v RS= '{ n=NF/2; for(i=1;i<=n;i++) print $i ":" $(i+n) }'
The output:
a:1b:2c:3d:4e:5
Solution 2:
resolved from: xpath html combine columns
solution:
wget -q -O - "https://socks-proxy.net" \
| xmllint --html --xpath "//table[@id='proxylisttable']//tr//td[position() < 3]" - 2>/dev/null
| tidy -cq -omit -f /dev/null | xmllint --html --xpath "//td/text()" - | paste - - -d':'
many thanks to @RomanPerekhrest
Post a Comment for "Xpath Html Get All Columns 1 And 2 Together And Concatenate With Column ":""