Précédent   Forum des professionnels en informatique > Systèmes > Linux > Applications > Shell
Shell Vos questions sur l'utilisation des commandes shell
Partagez cette discussion sur d'autres réseaux sociaux : Viadeo Twitter Google Facebook Digg Delicious MySpace Yahoo
Réponse Proposer ce sujet en actualité
 
Outils de la discussion
Publicité
'
Vieux 10/01/2008, 13h31   #1
Invité de passage
 
Inscription : janvier 2008
Messages : 2
Détails du profil
Informations forums :
Inscription : janvier 2008
Messages : 2
Points : 0
Points : 0
Par défaut Traduction script Solaris -> Redhat

Bonjour,

J'ai un script qui tourne sur SUN (Solaris 8) et que j'ai récemment du migrer sur un serveur Linux (redhat 8.0)... un commande de ce script ne fonctionne plus, pourriez-vous m'aider à la "traduire", la voici :

Citation:
CPT1=`grep -c -w "interfaces.ifTable.ifEntry.ifOperStatus.1[0-9]\{2,3\} : INTEGER: up" .Resultats_modifs`
Merci d'avance

Yannosh
yannosh001 est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 10/01/2008, 13h35   #2
Expert Confirmé
 
Avatar de Katyucha
 
Inscription : mars 2004
Messages : 3 109
Détails du profil
Informations personnelles :
Âge : 31
Localisation : Allemagne

Informations forums :
Inscription : mars 2004
Messages : 3 109
Points : 3 313
Points : 3 313
Citation:
man grep
:=)
Citation:
grep [ -E | -F ] [ -i ] [ -h ] [ -H ] [ -L ] [ -r | -R ] [ -s ] [ -v ] [ -w ] [ -x ] [ -y ] [ [ [ -b ] [ -n ] ] | [
-c | -l | -q ] ] [ -p [ Separator ] ] { [ -e PatternList ... ] [ -f PatternFile ... ] | PatternList ... } [ File ...
]


The grep command searches for the pattern specified by the Pattern parameter and writes each matching line to
standard output. The patterns are limited regular expressions in the style of the ed or egrep command. The grep
command uses a compact non-deterministic algorithm.


-w
Does a word search.

-c
Displays only a count of matching lines.
__________________
Ancien Rédacteur Linux && Unix / Nouveau retraité de DVP
The UNIX way of sex:
gunzip;strip;touch;finger;mount;fsck;more;yes;umount;sleep

Je ne réponds ni aux messages privées, ni aux messages plein de fautes...
Katyucha est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 10/01/2008, 13h51   #3
Invité de passage
 
Inscription : janvier 2008
Messages : 2
Détails du profil
Informations forums :
Inscription : janvier 2008
Messages : 2
Points : 0
Points : 0
merci, mais justement je pense que mon problème vient de la syntaxe de : ifOperStatus.1[0-9]\{2,3\}

voila ce que dit mon man grep :

Citation:
-w, --word-regexp

Select only those lines containing matches that form whole words. The test is that the matching substring must either be the beginning of the line, or preceded by a non_word constituent character. Similarly, it must be either at the end of the line or followed by a non-word constituent character. Word-constituent characters are lettres, digits and the underscore.
Cela ne me donne pas vraiment la syntaxe
yannosh001 est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 10/01/2008, 14h29   #4
Modérateur
 
Avatar de gangsoleil
 
R&D en systemes informatiques bas niveau Unix/Linux
Inscription : mai 2004
Messages : 5 496
Détails du profil
Informations personnelles :
Âge : 31
Localisation : France, Isère (Rhône Alpes)

Informations professionnelles :
Activité : R&D en systemes informatiques bas niveau Unix/Linux

Informations forums :
Inscription : mai 2004
Messages : 5 496
Points : 9 677
Points : 9 677
Bonjour,

Il s'agit d'une expression régulière, qui n'est pas gérée par grep comme ca...

Sur ton solaris, vérifie quel grep tu utilises (which grep ; alias grep ; ...).

Sur RedHat, essaye soit en utilisant grep -e, soit egrep.
__________________
Modérateur "C", "Informatique Générale & Hardware" et "Unix"
Les règles du forum
gangsoleil est déconnecté   Envoyer un message privé Réponse avec citation 00
Réponse Proposer ce sujet en actualité
Outils de la discussion



Fuseau horaire GMT +2. Il est actuellement 17h32.


 
 
 
 
Partenaires

Hébergement Web