Operating System - HP-UX
1752544 Members
4808 Online
108788 Solutions
New Discussion

searches with the grep command

 
robert4604
Occasional Contributor

searches with the grep command

I am new to HPUX. I am having some trouble formulating a command within grep to search for a specific message as follows:  vx_nospace - /dev/vg02_eva/lvol4 file system full 

Is there anyone wiling to help? I know it needs to start with the grep command but no matter how I assemble the command, I cant get it to find "no_space" or "file system full"

Thanks in advance

2 REPLIES 2
Steven Schweda
Honored Contributor

Re: searches with the grep command

> [...] a command within grep to search for a specific message [...]

   Do you want to search in one file or in multiple files?

> [...] no matter how I assemble the command, [...]

   Some examples of failed attempts would have been more useful than
that.  With my weak psychic powers, I can only try to guess what you
might be doing wrong.

> I cant get it to find "no_space" or "file system full"

   One explanation for the first part of that would be that the message
shown says "_nospace", not "no_space".

pro3$ echo 'vx_nospace - /dev/vg02_eva/lvol4 file system full' >
fred.txt

pro3$ grep 'file system full' fred.txt
vx_nospace - /dev/vg02_eva/lvol4 file system full

pro3$ grep 'file system empty' fred.txt
pro3$

Dennis Handly
Acclaimed Contributor

Re: searches with the grep command

> grep to search for a specific message as follows:  vx_nospace - /dev/vg02_eva/lvol4 file system full 

 

If you're looking for a fixed prefix and fixed suffix, you can use:

grep 'vx_nospace.*file system full' file