From mboxrd@z Thu Jan 1 00:00:00 1970 Message-ID: <102653680322111.tru64-unix-managers.marc@archive.invalid> From: Edward Dubrovsky/CGI Date: Tue, 25 Sep 2001 14:45:08 +0000 To: tru64-unix-managers Subject: SUMMARY: Scripting question X-MARC-Message: https://marc.info/?l=tru64-unix-managers&m=102653680322111 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. ____