Aptrug
Re:Poll: Where do you live?
on Friday February 04, 2022 @03:40PM (#30212825)
I was curious to know which locations are ranked the highest,
so I made this quick 'n' dirty shell script:
#!/bin/sh
curl -s 'https://news.ycombinator.com/item?id=30210378' | awk '
BEGIN {
FS = "[<>]"
}
{
for (i = 1; i <= NF; ++i) {
if ($i == "font color=\"#000000\"") {
printf "%s, ", $(i+1)
} else if ($i ~ /^span class="score" id="score_/) {
print $(i+1)
}
}
}
' | sort -t',' -nk2
It scrapes the web page, so it's kind of fragile.
Re:Awk: The Power and Promise of a 40-Year-Old Language
on Tuesday September 07, 2021 @05:09PM (#28449990)