RE: [HS] awk
Le
DUFRESNE, Matthias \(STERIA\)
Bonjour à tous,
En fait c'est tout simple :
echo 1 2 3 4 5 | awk '{ for(i=1; i<=$NF; i++) if (i > 2) print $i }'
affichera :
3
4
5
6
Il ne reste qu'à voir comment metre ces champs sur une seule ligne
--Original Message--
From: Alexandre [mailto:neonoe123321@gmail.com]
Sent: jeudi 24 juillet 2008 08:17
To: debian-user-french@lists.debian.org
Subject: Re: [HS] awk
Le mercredi 23 juillet de l'année 2008, vers 15 heures et 40 minutes, DUF=
RESNE, Matthias (STERIA) écrivait:
> Bonjour à tous,
Bonjour,
>
> Je cherche à savoir s'il n'existerait pas une astuce pour que awk affic=
he « la
> fin de la ligne après l'élément $n ».
pas sûr que ce soit ça mais sait-on jamais, si ça peut aider:
#!/bin/awk -f
{ print $NF; }
?
--
()()()-()()()-()()()--)()()(-)()()(-)()()(
-()-()--()-()--()-()--)(-)(--)(-)(--)(-)(-
()-()-()()()-()()()-)()()(-)()()(-)(-)(
--
The information in this e-mail is confidential. The contents may not be dis=
closed or used by anyone other then the addressee. Access to this e-mail by=
anyone else is unauthorised.
If you are not the intended recipient, please notify Airbus immediately and=
delete this e-mail.
Airbus cannot accept any responsibility for the accuracy or completeness of=
this e-mail as it has been sent over public networks. If you have any conc=
erns over the content of this message or its Accuracy or Integrity, please =
contact Airbus immediately.
All outgoing e-mails from Airbus are checked using regularly updated virus =
scanning software but you should take whatever measures you deem to be appr=
opriate to ensure that this message and any attachments are virus free.
--
Lisez la FAQ de la liste avant de poser une question :
http://wiki.debian.org/DebFrFrenchLists
Vous pouvez aussi ajouter le mot ``spam'' dans vos champs "From" et
"Reply-To:"
To UNSUBSCRIBE, email to debian-user-french-REQUEST@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org
En fait c'est tout simple :
echo 1 2 3 4 5 | awk '{ for(i=1; i<=$NF; i++) if (i > 2) print $i }'
affichera :
3
4
5
6
Il ne reste qu'à voir comment metre ces champs sur une seule ligne
--Original Message--
From: Alexandre [mailto:neonoe123321@gmail.com]
Sent: jeudi 24 juillet 2008 08:17
To: debian-user-french@lists.debian.org
Subject: Re: [HS] awk
Le mercredi 23 juillet de l'année 2008, vers 15 heures et 40 minutes, DUF=
RESNE, Matthias (STERIA) écrivait:
> Bonjour à tous,
Bonjour,
>
> Je cherche à savoir s'il n'existerait pas une astuce pour que awk affic=
he « la
> fin de la ligne après l'élément $n ».
pas sûr que ce soit ça mais sait-on jamais, si ça peut aider:
#!/bin/awk -f
{ print $NF; }
?
--
()()()-()()()-()()()--)()()(-)()()(-)()()(
-()-()--()-()--()-()--)(-)(--)(-)(--)(-)(-
()-()-()()()-()()()-)()()(-)()()(-)(-)(
--
The information in this e-mail is confidential. The contents may not be dis=
closed or used by anyone other then the addressee. Access to this e-mail by=
anyone else is unauthorised.
If you are not the intended recipient, please notify Airbus immediately and=
delete this e-mail.
Airbus cannot accept any responsibility for the accuracy or completeness of=
this e-mail as it has been sent over public networks. If you have any conc=
erns over the content of this message or its Accuracy or Integrity, please =
contact Airbus immediately.
All outgoing e-mails from Airbus are checked using regularly updated virus =
scanning software but you should take whatever measures you deem to be appr=
opriate to ensure that this message and any attachments are virus free.
--
Lisez la FAQ de la liste avant de poser une question :
http://wiki.debian.org/DebFrFrenchLists
Vous pouvez aussi ajouter le mot ``spam'' dans vos champs "From" et
"Reply-To:"
To UNSUBSCRIBE, email to debian-user-french-REQUEST@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org

Poser une question


bonjour,
~ $ echo {1..42} |
awk 'NF>33 { for(n=NF ;n > 33 ;n--){s=$n OFS s};
print s}'
34 35 36 37 38 39 40 41 42
(on peut fignoler en enlevant l'OFS final).
[...]
Non, ça ne donne que le dernier champ... (ou par exemple l'avant-dernier
avec « $(NF - 1) »).
--
Jacques L'helgoualc'h
--
Lisez la FAQ de la liste avant de poser une question :
http://wiki.debian.org/DebFrFrenchLists
Vous pouvez aussi ajouter le mot ``spam'' dans vos champs "From" et
"Reply-To:"
To UNSUBSCRIBE, email to
with a subject of "unsubscribe". Trouble? Contact