4 ms·
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
by y0ghur7_xxx 14y ago
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
- etrain 14y agoI 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
- icebraining 14y agoNotice that with parallel, you don't need the -n 1, since that's the default.
- etrain 14y agoAh, didn't realize that - throwback to my xargs days! Thanks for the tip.
- crusso 14y agoThanks 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).
- ole-tange 14y agoIf 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.
- philsnow 14y agoYou don't need to spawn N awks, <domains.txt while read line; do host $line | head -n1 & done | awk '{print $1 " -> " $4}'