lundi 30 juillet 2012

bash, sort

Bien souvent, on recherche des fichiers avec la commande find dans une arborescence. L'option "-printf format" permet d'afficher une ligne pour chaque entrée trouvée. Le format permet d'afficher les dates/heures, le basename de l'entrée...

$ find src/main/webapp/changes.log -printf '%f\n'
changes.log
$ find src/main/webapp/changes.log -printf '%h\n'
src/main/webapp
Ca peut être bien utile de connaître cette option ;)