Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

I know it's about Go, but bash is awesome for stuff like this:

   while read line; do
   host $line | head -n1 | awk '{print $1 " -> " $4}' &
   done < domains.txt


I realize it's a one-off, but you could potentially mix lines of output with a script like that.

If you gnu parallel (xargs++) installed - turn that second line into a script (and replace $line with $1).

  cat domains.txt | parallel -n 1 -P 50 script.sh


Notice that with parallel, you don't need the -n 1, since that's the default.


Ah, didn't realize that - throwback to my xargs days! Thanks for the tip.


Thanks for the note on parallel, it looks to be an excellently useful tool. I can find a lot of ways to save time with it.

FYI: On OSX, there is a Homebrew formula (brew install parallel).


If you are looking for which domain point to 1.2.3.4:

   cat domains.txt | parallel -P 100 --tag host | grep 1.2.3.4
Somewhat slower runtime than the go-solution, but may be faster to write.


You don't need to spawn N awks,

  <domains.txt while read line; do
    host $line | head -n1 &
  done | awk '{print $1 " -> " $4}'




Consider applying for YC's Winter 2026 batch! Applications are open till Nov 10

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: