cancel
Showing results for 
Search instead for 
Did you mean: 

Vi question

SOLVED
Go to solution
Mike Boswell_1
Frequent Advisor

Vi question

This command will print out all lines from catalina.out that match HOME or ERROR or WARN. awk '/HOME|ERROR|WARN/{print $0}' catalina.out

How could I do the same within vi? IE the following :%g!/ERROR/d will delete all lines that do not match ERROR but I would like WARN and HOME to remain as well.

Thanks,
Mike
4 REPLIES
Ivan Ferreira
Honored Contributor

Re: Vi question

Is it a requisite to do it with vi? isn't it enough to redirect the ouput of awk to another file?
Por que hacerlo dificil si es posible hacerlo facil? - Why do it the hard way, when you can do it the easy way?
Mike Boswell_1
Frequent Advisor

Re: Vi question

No not a requisite just want to know the equiv in Vi.
Jean-Luc Oudart
Honored Contributor
Solution

Re: Vi question

Try

:%g!/ERROR\|WARN\|HOME/d

Regards
Jean-Luc
fiat lux
Mike Boswell_1
Frequent Advisor

Re: Vi question

Thanks Jean-Luc !