|
|
|
|
||||||
| comp.unix.shell Using and programming the Unix shell. |
![]() |
|
|
LinkBack | Outils de la discussion |
|
|
#1 (permalink) |
|
Messages: n/a
Hébergeur: |
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 |
|
|
|
#2 (permalink) |
|
Messages: n/a
Hébergeur: |
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 |
|
|
|
#3 (permalink) |
|
Messages: n/a
Hébergeur: |
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 |
|
|
|
#4 (permalink) |
|
Messages: n/a
Hébergeur: |
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 |
|
![]() |
| Outils de la discussion | |
|
|