Résultats script bash
Fermé
kanshot
Messages postés
1
Date d'inscription
mercredi 25 septembre 2013
Statut
Membre
Dernière intervention
25 septembre 2013
-
25 sept. 2013 à 22:35
mamiemando Messages postés 33636 Date d'inscription jeudi 12 mai 2005 Statut Modérateur Dernière intervention 18 avril 2025 - 27 sept. 2013 à 00:09
mamiemando Messages postés 33636 Date d'inscription jeudi 12 mai 2005 Statut Modérateur Dernière intervention 18 avril 2025 - 27 sept. 2013 à 00:09
A voir également:
- Résultats script bash
- Script vidéo youtube - Guide
- Lexer resultats - Télécharger - Sport
- Resultats foot - Télécharger - Vie quotidienne
- Mas script - Accueil - Windows
- Ghost script - Télécharger - Polices de caractères
1 réponse
mamiemando
Messages postés
33636
Date d'inscription
jeudi 12 mai 2005
Statut
Modérateur
Dernière intervention
18 avril 2025
7 842
27 sept. 2013 à 00:09
27 sept. 2013 à 00:09
Personnellement j'aurais écrit un truc dans ce genre (en supposant que l'on cherche google.fr dans le fichier index.html), ici dans un shell :
... ou dans un script dans ce genre :
Bonne chance
for domain in $(grep -o "[a-zA-Z0-9]*\.google\.fr" index.html | sort | uniq); do (ping -c2 $domain | grep -q " 0\% packet loss" || echo "$domain is unreachable"); done
... ou dans un script dans ce genre :
#!/bin/bash
# Example:
# $1 = "www.google.fr"
# url = "google\.fr"
# $2 = page = "index.html"
url=$(echo "$1" | sed -e "s/\./\\\\./g")
page=$2
pattern=$(echo $url | sed -e "s/[^.]*\.\(.*\)/\1/" | sed -e "s/\./\\\\./g")
for domain in $(grep -o "$pattern" "$page" | sort | uniq)
do
ping -c2 $domain | grep -q " 0\% packet loss" || echo "$domain is unreachable"
done
exit 0
Bonne chance