Retourner au contenu associé (entrée de forum : Récupérer des infos d'un fichier : parser.)
Posté par totof2000 le 09 mai 2011 à 21:29. En réponse au message Récupérer des infos d'un fichier : parser.. Évalué à 2.
GRRR !!!
Je recommence : awk -F"," '{for (i=1;i<=NF;i++) { split($i,tab,":") value=substr($i,length(tab[1])+2) hash[tab[1]]=value } } END { for (key in hash) { print "Key: " key ", value : " hash[key] } } ' toto.txt
J'ai juste viré les lignes commencant par "#" qui sont des commentaires.
AltStyle によって変換されたページ (->オリジナル) / アドレス: モード: デフォルト 音声ブラウザ ルビ付き 配色反転 文字拡大 モバイル
[^] # Re: awk est ton ami
Posté par totof2000 . En réponse au message Récupérer des infos d'un fichier : parser.. Évalué à 2.
GRRR !!!
Je recommence :
awk -F"," '{for (i=1;i<=NF;i++) {
split($i,tab,":")
value=substr($i,length(tab[1])+2)
hash[tab[1]]=value
}
}
END {
for (key in hash) {
print "Key: " key ", value : " hash[key]
}
} ' toto.txt
J'ai juste viré les lignes commencant par "#" qui sont des commentaires.