Étape 6: Utiliser grep pour extraire d’un flux
Fichier batch simple pour obtenir les informations météorologiques: (tête commande limite les résultats).
#! / bin/bash
zip = $1
TMon = $(date + "%b")
tjour = $(date + "%d")
echo "les conditions météorologiques pour $zip sur $tmon $tday: »
Lynx-largeur 1000 - dump "http://m.wund.com/cgi-bin/findweather/getForecast?brand=mobile & query = $zip" > météo
chat météo | grep « Mise à jour »
chat météo | grep « Observée »
chat météo | grep « Température »
chat météo | grep « Humidité »
chat météo | grep « Point de rosée »
chat météo | grep « Wind » | Head -1
chat météo | grep « Rafale de vent » | Head -1
chat météo | grep « Pression »
chat météo | grep « Conditions » | Head -1
chat météo | grep « Visibilité »
chat météo | grep « UV »
chat météo | grep « Nuages »
chat météo | grep « Maximum d’hier »
chat météo | grep « Minimum d’hier »
chat météo | grep « Sunrise »
chat météo | grep « Sunset »
chat météo | grep « Lever de lune »
chat météo | grep « Set de lune »
chat météo | grep-A1 « Phase de la lune »
chat météo | grep « METAR Raw »