bonjour
je voudrais savoir comment extraire ou afficher une ligne particulière d'un fichier en shell (par exemple : la ligne 3 du fichier toto) pour en faire une variable
merci
[jp@Mandrake scripts]$ cat fich nom_fichier_1 ; commentaire associé au fichier 1 nom_fichier_2 ; commentaire associé au fichier 2 nom_fichier_4 ; commentaire associé au fichier 4 nom_fichier_5 ; commentaire associé au fichier 5 nom_fichier_7 ; commentaire associé au fichier 7 nom_fichier_9 ; commentaire associé au fichier 9 nom_fichier_10 ; commentaire associé au fichier 10 nom_fichier_12 ; commentaire associé au fichier 12 nom_fichier_14 ; commentaire associé au fichier 14 nom_fichier_15 ; commentaire associé au fichier 15 nom_fichier_16 ; commentaire associé au fichier 16
[jp@Mandrake scripts]$ sed -n 3p fich nom_fichier_4 ; commentaire associé au fichier 4
[jp@Mandrake scripts]$ sed -n 5p fich nom_fichier_7 ; commentaire associé au fichier 7
[jp@Mandrake scripts]$ var=`sed -n 5p fich` [jp@Mandrake scripts]$ echo $var nom_fichier_7 ; commentaire associé au fichier 7 [jp@Mandrake scripts]$;-))
var=`head -$nu_ligne $fichier | tail -1`
var=`awk -v l=$nu_ligne 'NR==l{ print }' $fichier`
Combien cela coûte-t-il au total ? Quelles aides apportent l'état et les acteurs du marché pour alléger cette charge non choisie ? Tous les détails sur Commentçamarche.net.