Grep et exclusion nom fichier

Résolu
Bonjour,

Je souhaiterais chercher une chaîne de caractères dans des fichiers avec GREP .

awstats.toto.mobil.conf
awstats.toto.conf


Par contre je ne souhaite chercher que dans les fichiers n'ayant pas dans leur nom mobil

Si je fais cela
grep 'chaine' awstats.*.conf


Il cherche aussi dans les fichier contenant dans leurs noms mobil

Cette commande fonctionne pas!
grep --exclude=*.mobil.conf -e 'chaîne'


Comment faire!

Merci

Configuration: Debian Jessie , Firefox


L'accès au savoir est la première liberté que chaque homme devrait avoir.

3 réponses

  1. Contributeur
    Salut,

    C'est bizarre que le "--exclude" ne marche pas ;-\

    $ more fich*
    ::::::::::::::
    fich.titi.txt
    ::::::::::::::
    bonjour hello salut hola
    ::::::::::::::
    fich.toto.txt
    ::::::::::::::
    bonjour hello salut hola
    ::::::::::::::
    fich.tutu.txt
    ::::::::::::::
    bonjour hello salut hola

    $ grep --exclude=*.titi.txt 'hola' fich*
    fich.toto.txt:bonjour hello salut hola
    fich.tutu.txt:bonjour hello salut hola

    0
    1. Je viens de refaire mais marche pas car il m'affiche aussi les fichiers exclus!

      grep --exclude=*.mobile  'chaine'  awstats.*

      awstats.toto.mobile.conf
      awstats.tata.conf


      0
      1. Contributeur
        Essaie avec
        grep --exclude=*.mobile.conf 'chaine' awstats.*
        0
      2. J'avais déjà essayé mais merci. Je continue a chercher et si je trouve je viens poster la réponse.
        0
    2. Bon j'ai enfin trouvé la bonne syntaxe.

      grep --exclude='*.mobile.conf'  'mobile'  awstats.* 


      0