mercredi 19 décembre 2012

Exclude files or directories from commands

An easy way to remove elements from command line : 

root:/# rm !(*.c|*.h)  => remove every files except *.c or *.h) 

another syntax : 

root:/# rm !(*.@(c|h))  => same thing ...

Can be used with grep, for directories exlusion. :

root:/#  grep P770_P7_1_A30 !(www|logs)/* => grep P770_P7_1_A30 from every underlying directories, except www and logs

Aucun commentaire:

Enregistrer un commentaire