SUMMARY: Scripting question

From: Edward Dubrovsky/CGI <edward.dubrovsky_at_cgi.ca>
Date: Tue, 25 Sep 2001 10:45:08 -0400

Hi Everyone,

I sincerely apologize for the delay in this summary. My original question
was:

> Hi All,
>
> This should be a fairly easy question. I have created a file using awk
> containing a bunch of records from an iostat command output. I am
> filtering
> the idle cpu time via the awk command. Now as you know the first line
> would
> be blank (due to it being originally a date line), the 2nd line is also
> blank since it does not contain column 24 which I filter on (titles), the
> next line would contain the "id" column followed by two lines. The first
> line would be the average to this point and the second line would be the
> actual idle cpu time for this time/second.
>
> What I need to do is filter by every 5th line. Trying to figure out how
to
> grep this?? I was hoping perhaps someone can provide a quick response to
> this little problem.
>


I have received literally tens of answers here is what was basically
recommended:

Since iostat column 24 is the column displaying the CPU idle time, I have
awked columns 24 and only needed every fifth line so I used:

cat iostat.$EXTDATE| awk '{printf $24 "\n"}'|awk 'NR % 5 == 0 {print $0}' >
workfile.$EXTDATE

The second awk is the one I needed.

Thanks to everyone and I do mean everyone for all your insight and answers.

Regards,

Ed.

____
Received on Tue Sep 25 2001 - 14:51:25 NZST

This archive was generated by hypermail 2.4.0 : Wed Nov 08 2023 - 11:53:42 NZDT