[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[linux-team] Regexp en ligne de commande



Bonjour, 

ça doit être une bêtise, mais vu que je ne vois pas dans quel ordre je
peux le faire...

Je voudrais faire un backup du home directory de mes users: j'ai fait un
cron qui devrait lancer la ligne suivante:

find /home -mindepth 1 -maxdepth 1 -exec tar -uvzf /backup/{}.tgz {} \;

mais je voudrais faire une regexp sur le premier paramètre pour n'en
conserver que la fin.
En effet, la commande 

find /home -mindepth 1 -maxdepth 1 -exec echo {} \;  

affiche:
/home/chris
/home/paul
...

et j'aimerais bien que mes fichiers archives soient
/backup/chris.tgz
/backup/paul.tgz 
...

plutôt que
/backup/home/chris.tgz
...


J'ai essayé de me battre avec sed,
mais dès que je fais un truc du style 

find /home -mindepth 1 -maxdepth 1 -exec echo {} | more \;

il refuse. Comment lui dire que "echo {} | more" est l'entièreté de la
commande ?
... et si je fais le pipe sur toute la commande find, je ne suis pas
plus avancé car je dois aussi conserver l'argument {} original pour
avoir le chemin du fichier dans tar...

Je crois que c'est pas trop compliqué à faire, mais qu'il faut juste
connaître le truc. 

Toute aide est la bienvenue,

merci,

Christophe. 
-- 
>>>>--------------->
Once it's perfectly aimed, the flying arrow goes straight to its target.
Thus, don't worry when things go right. 
There will be enough time to worry about if they go wrong.
Then, it's time to fire a new arrow towards another direction.
Don't sink.  Adapt yourself !  The archer has to shoot accurately and
quickly.
[Words of Erenthar, the bowman ranger]  <---------------<<<<
---------
Visit the Linux Supertore Online: http://www.redcorp.com !
If you want to be deleted from the list, send a mail to
majordomo@rtfm.be with "unsubscribe linux-team" in the body.
Archive of the list: http://tania.be.linux.org/