Skip to content

Instantly share code, notes, and snippets.

@Twibow
Created May 10, 2023 13:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Twibow/1bdb7885cc8c63563562f38b1371e4bd to your computer and use it in GitHub Desktop.
Save Twibow/1bdb7885cc8c63563562f38b1371e4bd to your computer and use it in GitHub Desktop.
Résolution de nom de domaine en masse
#!/bin/bash
if [ $# -lt 2 ]; then
echo "Usage: $0 input_file output_file"
exit 1
fi
input_file=$1
output_file=$2
while read -r domain; do
ip=$(ping -c 1 "$domain" | awk -F'[()]' '/PING/{print $2}')
if [ -n "$ip" ]; then
echo "$domain,$ip" >> "$output_file"
fi
done < "$input_file"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment