[Linux-bruxelles] grep

Jean-Marc jean-marc at 6jf.be
Ven 27 Sep 21:46:11 CEST 2013


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256

On 26/09/13 21:29, Dany De Bontridder wrote:
> Je ne parlais pas de la commande qui est (ou non) complète mais de
> la liste des possibilités ;-)
> 
Pour être vraiment complet, il faut savoir que les formes :
ls -rt |while read A;do grep xxx $A;done
grep -i mmm `ls -rt *.txt`
grep -i telenet $(ls -rt *.txt)

créent un shell-fils (un fork du shell courant) soit pour exécuter la
commande <ls>, soit <grep>, ce qui est plus gourmand en ressource.

Ce qui n'est pas le cas de la forme :
ls -tr | xargs grep -i lachainerechechee

D'autre part, <`ls -rt *.txt`> avec les quotes inversées est
l'ancienne manière d'écrire <$(ls -rt *.txt)>, cette ancienne manière
ayant des restrictions quant à l'utilisation du caractère backslash,
restrictions n'existant pas dans la nouvelle manière avec $().

Je préfère donc pour ma part le pipe et xargs.

Jean-Marc
- -----
jim at jabber.belnet.be
http://jim.brubel.net/
http://identi.ca/jimlevert
http://twitter.com/JimleVert
- -----
1 personne sur 10 comprend le binaire.  L'autre pas.
J'utilise DuckDuckGo (https://duckduckgo.com/).  Et toi ?
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.14 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iQIcBAEBCAAGBQJSReB8AAoJEECwQOvthjrRTgIQAK5ZefXPYx9BgayoYKOy+ecL
9RJJvQlL3TUdMZ+XvZm2mQu5WBQCXG/oHYF/MS+p4Ew794bcLetTb0R7lS5zM4io
gAbvtEg9dKwzFkzynklDmnQU0WUyvDU6GzCs4Z0QW+0Kw2IF+aS1H91ZhWED7pN9
JdFz3SGfSznA/a7URXn0Nc9wAykuouiicTHVWE1joIPccQKp/9JgpFcAPhDLd1m+
y/u15pL2pUz6WsMxsguq0kkYbY8ApziA5RIdCs6+et07DApCzu82/i4upMFT/jA0
dC23lMhalYkLKQbZzyEUqG2stedGSzb9hYmQ7zjDMdxtaB/jKWsWmI6lWo9fcqdN
EQ8JGSwoQRUSOBXQjy68PqwnH5t8bvRkvfGypuq9viBKFq/cGxtIUdEj0iia3+mR
af0cbmqREC0NiSQSFd0qkf/OVKWh6IdcWg1LAfhXpHQjBAWYLpg1A5ll8Jdli8ol
y5skgHVxd3dB/O6Yv+eRwS8pZRPZ4HwRMOcGj3dv+BLcBgZydP538U4ZrZA8OFPI
ga/GOAaCnF7b5tViEsJtArvkbspJDI7fRgsdgkfcTsYm89eJCfvTGVbjtI7q7WK1
JjMqKFQ+1eP0krtsYeFqC/6OeVg9jltpdAphB35OcGx3sGGzhb/7S59UFpivs5qe
KQ4cehk6YXdwPEuyYLWq
=Z3ay
-----END PGP SIGNATURE-----



Plus d'informations sur la liste de diffusion Linux-bruxelles