PHWinfo banniere

Titres
PORTAIL ANNUAIRE ARTICLES COMPARATEUR HÉBERGEURS DEVIS FORUMS RÉDUCTEUR D'URL
Précédent   PHWinfo > Forums Hébergement > Forum Serveur - Sécurité et techniques > comp.unix.shell > pattern match
S'inscrire FAQ Membres Recherche Messages du jour Marquer les forums comme lus
comp.unix.shell Using and programming the Unix shell.

pattern match

Réponse
 
LinkBack Outils de la discussion
Vieux 18/08/2006, 03h59   #1
tim_batiees@hotmail.com
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut pattern match

If I want to gather any error, warnings in /var/adm/messages.
How to use korn shell to do that?

As if I use "grep -i error /var/adm/messages" , then for "warning" , I
have to do "grep -i warning /var/adm/messages", that means I have to do
twice. How can I do it once to patten match two or more words?

Thanks

  Réponse avec citation
Vieux 18/08/2006, 04h15   #2
Xicheng Jia
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: pattern match

tim_batiees@hotmail.com wrote:
> If I want to gather any error, warnings in /var/adm/messages.
> How to use korn shell to do that?
>
> As if I use "grep -i error /var/adm/messages" , then for "warning" , I
> have to do "grep -i warning /var/adm/messages", that means I have to do
> twice. How can I do it once to patten match two or more words?


grep -iF 'warning
error' /var/adm/messages

Xicheng

  Réponse avec citation
Vieux 18/08/2006, 04h27   #3
Chris F.A. Johnson
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: pattern match

On 2006-08-18, tim_batiees@hotmail.com wrote:
> If I want to gather any error, warnings in /var/adm/messages.
> How to use korn shell to do that?
>
> As if I use "grep -i error /var/adm/messages" , then for "warning" , I
> have to do "grep -i warning /var/adm/messages", that means I have to do
> twice. How can I do it once to patten match two or more words?


grep -i -e warning -e error /var/adm/messages

--
Chris F.A. Johnson, author <http://cfaj.freeshell.org>
Shell Scripting Recipes: A Problem-Solution Approach (2005, Apress)
===== My code in this post, if any, assumes the POSIX locale
===== and is released under the GNU General Public Licence
  Réponse avec citation
Vieux 18/08/2006, 04h55   #4
Bill Seivert
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: pattern match



tim_batiees@hotmail.com wrote:
> If I want to gather any error, warnings in /var/adm/messages.
> How to use korn shell to do that?
>
> As if I use "grep -i error /var/adm/messages" , then for "warning" , I
> have to do "grep -i warning /var/adm/messages", that means I have to do
> twice. How can I do it once to patten match two or more words?
>
> Thanks
>


egrep -i "error|warning" /var/adm/messages

Bill Seivert

  Réponse avec citation
Réponse


Outils de la discussion

Règles de messages
Vous ne pouvez pas créer de nouvelles discussions
Vous ne pouvez pas envoyer des réponses
Vous ne pouvez pas envoyer des pièces jointes
Vous ne pouvez pas modifier vos messages

Les balises BB sont activées : oui
Les smileys sont activés : oui
La balise [IMG] est activée : oui
Le code HTML peut être employé : non
Trackbacks are oui
Pingbacks are oui
Refbacks are oui


Fuseau horaire GMT +1. Il est actuellement 10h52.


Édité par : vBulletin® version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0 RC5 Tous droits réservés.
Version française #16 par l'association vBulletin francophone
PHWinfo est un site Éducation Sans Frontières ©2000-2008
Ad Management by RedTyger
©Tous droits réservés par les parties respectives
Page generated in 1,61389 seconds with 12 queries