[gull] dernier élément d'une liste

Arnaud Burlet arnaud.burlet at epfl.ch
Fri Jul 2 18:09:01 CEST 2004


Certainement plus lent, mais ca fonctionne !

echo $foo | sed -e "s/ /\n/g" | tail -n 1

c'est la command tail qui s'occupe de ce que tu veux...

Arnaud

On ven, 2004-07-02 at 18:00, patrick jayet wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
> 
> Bonjour à tous,
> 
> Je recherche une ou plusieurs commandes bash permettant d'obtenir le
> dernier élément d'une liste de mots séparés par des espaces.
> 
> ex. foo="once upon a time"
> but: obtenir "time".
> 
> J'ai essayé avec cut (echo $foo | cut -d " " -f <dernier>),
> malheureusement je n'ai pas trouvé de moyen de spécifier la dernière
> occurence.
> 
> Une idée?
> 
> Salutations. :o)
> 
> Patrick
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.2.4 (GNU/Linux)
> Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
> 
> iD8DBQFA5YaVDdcPKzlCXVMRAp8OAJ9pyNcgMCMQ2b+gY+WIRTafv9KAbACfQcho
> n3wSqPcJ5zD0ZFTelY9nM6Q=
> =+lI/
> -----END PGP SIGNATURE-----
> _______________________________________________
> gull mailing list
> gull at lists.alphanet.ch
> http://lists.alphanet.ch/mailman/listinfo/gull
-- 
Arnaud Burlet <arnaud.burlet at epfl.ch>




More information about the gull mailing list