[HS] awk

View: New views
4 Messages — Rating Filter:   Alert me  

[HS] awk

by DUFRESNE, Mathias (STERIA) :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Some parts of this message have been removed. Learn more about Nabble's security policy.

Bonjour à tous,

 

Je cherche à savoir s’il n’existerait pas une astuce pour que awk affiche « la fin de la ligne après l’élément $n ».

 

Ce qui serait l’équivalent du « cut –f2- »

 

A plus : )

 

The information in this e-mail is confidential. The contents may not be disclosed 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 concerns 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 appropriate to ensure that this message and any attachments are virus free.

Re: [HS] awk

by neonoe123321 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Le mercredi 23 juillet de l'année 2008, vers 15 heures et 40 minutes, DUFRESNE, Matthias (STERIA) écrivait:
> Bonjour à tous,
Bonjour,

>
> Je cherche à savoir s’il n’existerait pas une astuce pour que awk affiche « 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; }


?
--
---()()()----()()()----()()()--)()()(----)()()(----)()()(---
-()----()--()-()-----()----()--)(----)(-----)(-)(--)(----)(-
()----()----()()()----()()()----)()()(----)()()(----)(----)(

--
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@...
with a subject of "unsubscribe". Trouble? Contact listmaster@...


Parent Message unknown RE: [HS] awk

by DUFRESNE, Mathias (STERIA) :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

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@...]
Sent: jeudi 24 juillet 2008 08:17
To: debian-user-french@...
Subject: Re: [HS] awk

Le mercredi 23 juillet de l'année 2008, vers 15 heures et 40 minutes, DUFRESNE, Matthias (STERIA) écrivait:
> Bonjour à tous,
Bonjour,

>
> Je cherche à savoir s'il n'existerait pas une astuce pour que awk affiche « 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 disclosed 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 concerns 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 appropriate 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@...
with a subject of "unsubscribe". Trouble? Contact listmaster@...


Re: [HS] awk

by Jacques L'helgoualc'h :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

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 debian-user-french-REQUEST@...
with a subject of "unsubscribe". Trouble? Contact listmaster@...