Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
commande en awk
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index French
View previous topic :: View next topic  
Author Message
sebweb
Apprentice
Apprentice


Joined: 29 Jan 2003
Posts: 220
Location: Bordeaux - France

PostPosted: Sun Mar 30, 2003 9:06 pm    Post subject: commande en awk Reply with quote

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
View user's profile Send private message
TGL
Bodhisattva
Bodhisattva


Joined: 02 Jun 2002
Posts: 1978
Location: Rennes, France

PostPosted: Mon Mar 31, 2003 9:33 am    Post subject: Reply with quote

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 :wink:
Back to top
View user's profile Send private message
sebweb
Apprentice
Apprentice


Joined: 29 Jan 2003
Posts: 220
Location: Bordeaux - France

PostPosted: Mon Mar 31, 2003 11:54 am    Post subject: Reply with quote

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 :D
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index French All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum