From owner-freebsd-questions@FreeBSD.ORG Fri Jul 15 04:03:17 2005 Return-Path: X-Original-To: freebsd-questions@freebsd.org Delivered-To: freebsd-questions@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 3A6C216A41C for ; Fri, 15 Jul 2005 04:03:17 +0000 (GMT) (envelope-from dan@dan.emsphone.com) Received: from dan.emsphone.com (dan.emsphone.com [199.67.51.101]) by mx1.FreeBSD.org (Postfix) with ESMTP id E0A1F43D46 for ; Fri, 15 Jul 2005 04:03:16 +0000 (GMT) (envelope-from dan@dan.emsphone.com) Received: (from dan@localhost) by dan.emsphone.com (8.13.1/8.13.3) id j6F43GxB099478; Thu, 14 Jul 2005 23:03:16 -0500 (CDT) (envelope-from dan) Date: Thu, 14 Jul 2005 23:03:16 -0500 From: Dan Nelson To: hzs202@nyu.edu Message-ID: <20050715040316.GB98600@dan.emsphone.com> References: <42D7236A.6010803@gmail.com> <20050715032319.GA98600@dan.emsphone.com> <42D730EB.6070905@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <42D730EB.6070905@gmail.com> X-OS: FreeBSD 5.4-STABLE X-message-flag: Outlook Error User-Agent: Mutt/1.5.9i Cc: freebsd-questions@freebsd.org Subject: Re: Problem Piping iostat -c to awk! X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 15 Jul 2005 04:03:17 -0000 In the last episode (Jul 14), Hakim Singhji said: > > | iostat -c 300 1 | awk '!/[a-zA-Z]|^$/ {print $1}' > > This doesn't seem to work for me... awk tells me: > > awk syntax error at source line 1 > *** > /[a: Event not found. > > Not sure how to allow awk to delete two top rows of iostat... other that > the grep option -v. Does not seem to be working in awk. You're probably running csh or tcsh, which try and interpret the ! character even in quotes. It'll work in a script, but on the commandline you'll need to change it to \! . Alternatively, you can print only lines with leading spaces followed by a number with: iostat -c 300 1 | gawk '/^ +[0-9]/ {print $1}' -- Dan Nelson dnelson@allantgroup.com