View previous topic :: View next topic |
Author |
Message |
sebweb Apprentice
Joined: 29 Jan 2003 Posts: 220 Location: Bordeaux - France
|
Posted: Sun Mar 30, 2003 9:06 pm Post subject: commande en awk |
|
|
Salut a tous
Une petite question sur awk :
J'ai une commande de ce type :
Code: |
avalaible=`emerge -up world | grep ebuild | awk 'BEGIN { nb = 0 } ; { nb = nb +1 } ; END { print nb }'`
|
Le code awk doit certainement pouvoir s'améliorer, c'est pas trés propre.
Merci de votre aide |
|
Back to top |
|
|
TGL Bodhisattva
Joined: 02 Jun 2002 Posts: 1978 Location: Rennes, France
|
Posted: Mon Mar 31, 2003 9:33 am Post subject: |
|
|
Pour ce qui est de ton code awk, je vois pas vraiment quoi améliorer... Par contre, si tu veux juste compter des lignes, t'as pas vraiment besoin de awk : y'a "wc -l" pour ça |
|
Back to top |
|
|
sebweb Apprentice
Joined: 29 Jan 2003 Posts: 220 Location: Bordeaux - France
|
Posted: Mon Mar 31, 2003 11:54 am Post subject: |
|
|
Ben tu vois, je connaissait pas wc.
je vien de regarder et c'est exactement ce que faisait mon code awk en plus propre.
Merci |
|
Back to top |
|
|
|