From owner-freebsd-questions@FreeBSD.ORG Fri Jul 15 04:09:49 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 0B44F16A41C for ; Fri, 15 Jul 2005 04:09:49 +0000 (GMT) (envelope-from paul+fbsd@it.ca) Received: from haggis.it.ca (haggis.it.ca [216.126.86.9]) by mx1.FreeBSD.org (Postfix) with ESMTP id A058B43D45 for ; Fri, 15 Jul 2005 04:09:48 +0000 (GMT) (envelope-from paul+fbsd@it.ca) Received: from haggis.it.ca (paul@localhost [127.0.0.1]) by haggis.it.ca (8.12.11/8.12.11) with ESMTP id j6F49kww007929; Fri, 15 Jul 2005 00:09:46 -0400 (EDT) (envelope-from paul+fbsd@it.ca) Received: (from paul@localhost) by haggis.it.ca (8.12.11/8.12.6/Submit) id j6F49kdZ007928; Fri, 15 Jul 2005 00:09:46 -0400 (EDT) (envelope-from paul+fbsd@it.ca) X-Authentication-Warning: haggis.it.ca: paul set sender to paul+fbsd@it.ca using -f Date: Fri, 15 Jul 2005 00:09:46 -0400 From: Paul Chvostek To: hzs202@nyu.edu Message-ID: <20050715040946.GA4827@it.ca> 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> User-Agent: Mutt/1.4.2.1i Cc: Dan Nelson , 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 Reply-To: freebsd-questions@freebsd.org List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 15 Jul 2005 04:09:49 -0000 On Thu, Jul 14, 2005 at 11:43:39PM -0400, Hakim Singhji wrote: > > | 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. That's because you're using tcsh, and the exlcamation point is being interpreted as part of a shell history reference. You can turn this into a shell *script*, or just run it in bash or /bin/sh. Or if you absolutely must run it in csh/tcsh, escape the ! with a \ (yes, even inside single quotes). > 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 could try something like: iostat -c 300 | awk 'BEGIN {getline;getline;} $1~/^[0-9]+$/ {print $1}' or for something even lighter-weight: iostat -c 300 | sed -Ene 's/^ +//;s/ .*//;/^[0-9]+$/p' -- Paul Chvostek it.canada http://www.it.ca/