Twitter iPhone pliant OnePlus 11 PS5 Disney+ Orange Livebox Windows 11

RE: [HS] awk

1 réponse
Avatar
DUFRESNE, Matthias \(STERIA\)
Bonjour =E0 tous,

En fait c'est tout simple :
echo 1 2 3 4 5 | awk '{ for(i=3D1; i<=3D$NF; i++) if (i > 2) print $i }'

affichera :
3
4
5
6

Il ne reste qu'=E0 voir comment metre ces champs sur une seule ligne...

-----Original Message-----
From: Alexandre [mailto:neonoe123321@gmail.com]=20
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=E9e 2008, vers 15 heures et 40 minutes, DUF=
RESNE, Matthias (STERIA) =E9crivait:
> Bonjour =E0 tous,
Bonjour,

>=20
> Je cherche =E0 savoir s'il n'existerait pas une astuce pour que awk affic=
he =AB la
> fin de la ligne apr=E8s l'=E9l=E9ment $n =BB.

pas s=FBr que ce soit =E7a mais sait-on jamais, si =E7a peut aider:

#!/bin/awk -f
{ print $NF; }


?
--=20
---()()()----()()()----()()()--)()()(----)()()(----)()()(---
-()----()--()-()-----()----()--)(----)(-----)(-)(--)(----)(-
()----()----()()()----()()()----)()()(----)()()(----)(----)(

--=20



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

1 réponse

Avatar
Jacques L'helgoualc'h
DUFRESNE, Matthias (STERIA) a écrit, jeudi 24 juillet 2008, à 09:50 :
Bonjour à tous,



bonjour,

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...



~ $ 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).

Alexandre :


[...]
pas sûr que ce soit ça mais sait-on jamais, si ça peut aider:

#!/bin/awk -f
{ print $NF; }



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