Mailinglist Archive: opensuse (1461 mails)

< Previous Next >
Re: [opensuse] question about awk
  • From: Anders Johansson <ajohansson@xxxxxxx>
  • Date: Mon, 25 May 2009 03:11:13 +0200
  • Message-id: <200905250311.14134.ajohansson@xxxxxxx>
On Monday 25 May 2009 02:01:10 Chuck Payne wrote:
Guys,

A question. I been trying to figure out how to get the out put I want.
I got a log that I am do a grep on statement mykeyword, but I to get
it and the line that follows. I been doing a search now for how to do
this on google, but no luck. Is there a way of doing this, or do I
need to use grep.

If I parse your question correctly, what you're looking for is

grep -A 1 mykeyword logfile

An awk hack (I'm not very fluent in awk-ish):

{
while ($0 ~ /foo/) {
print;
i=getline;
}
if (i > 0){
print;
print "---------";
i=0;
}
}

Just use grep

Anders

--
To unsubscribe, e-mail: opensuse+unsubscribe@xxxxxxxxxxxx
For additional commands, e-mail: opensuse+help@xxxxxxxxxxxx

< Previous Next >
Follow Ups
References