From owner-freebsd-questions@FreeBSD.ORG Fri Jan 20 23:19:35 2006 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 F36A216A41F for ; Fri, 20 Jan 2006 23:19:34 +0000 (GMT) (envelope-from don.hinton@vanderbilt.edu) Received: from smtp01.smtp.vanderbilt.edu (smtp01.smtp.Vanderbilt.Edu [129.59.1.92]) by mx1.FreeBSD.org (Postfix) with ESMTP id 844C343D48 for ; Fri, 20 Jan 2006 23:19:33 +0000 (GMT) (envelope-from don.hinton@vanderbilt.edu) Received: from smtp01.smtp.vanderbilt.edu (localhost [127.0.0.1]) by smtp01.smtp.vanderbilt.edu (8.12.11/8.12.11/VU-3.7.9C+d3.7.9) with ESMTP id k0KNJW9B023218; Fri, 20 Jan 2006 17:19:32 -0600 (CST) Received: from smtp09.smtp.vanderbilt.edu (smtp09.smtp.Vanderbilt.Edu [129.59.1.239]) by smtp01.smtp.vanderbilt.edu (8.12.11/8.12.11/VU-3.7.9.3B+d3.7.9) with ESMTP id k0KNJT4E023202 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Fri, 20 Jan 2006 17:19:30 -0600 (CST) Received: from smtp09.smtp.vanderbilt.edu (localhost [127.0.0.1]) by smtp09.smtp.vanderbilt.edu (8.12.11/8.12.11/VU-3.7.9C+d3.7.9) with ESMTP id k0KNJTlH002685; Fri, 20 Jan 2006 17:19:29 -0600 (CST) Received: from a129103.n1.vanderbilt.edu (A129103.N1.Vanderbilt.Edu [129.59.129.103]) by smtp09.smtp.vanderbilt.edu (8.12.11/8.12.11/VU-3.7.9.3B+d3.7.9) with ESMTP id k0KNJT2d002682 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Fri, 20 Jan 2006 17:19:29 -0600 (CST) From: Don Hinton Organization: ISIS To: freebsd-questions@freebsd.org Date: Fri, 20 Jan 2006 17:19:24 -0600 User-Agent: KMail/1.9.1 References: <755cb9fc0601201459v643bf464i892ef3efc68dc788@mail.gmail.com> In-Reply-To: <755cb9fc0601201459v643bf464i892ef3efc68dc788@mail.gmail.com> MIME-Version: 1.0 Content-Type: multipart/signed; boundary="nextPart2029823.R1IqImfhSs"; protocol="application/pgp-signature"; micalg=pgp-sha1 Content-Transfer-Encoding: 7bit Message-Id: <200601201719.29153.don.hinton@vanderbilt.edu> Cc: Alexandre Vieira Subject: Re: awk question 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, 20 Jan 2006 23:19:35 -0000 --nextPart2029823.R1IqImfhSs Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Content-Disposition: inline Hi Alexandre: On Friday 20 January 2006 16:59, Alexandre Vieira wrote: > Hello folks, > > I'm making a script to generate some statistics for a batch job and I'm > stuck with awk. > > For example: > > %echo 1 2 3 4 5 6 | awk {'print $1 $2 $3 $4 $5 $6'} > > it will output: > > 1 2 3 4 5 6 > > I want to tokenize a string with another separating char (the : char): > > %echo 1:2:3:4:5:6 > > and with awk to output: > > 1 2 3 4 5 6 > > Is there any way of doing this? Sure. Here's a link to the online awk documentation section on field=20 seperators... http://www.gnu.org/software/gawk/manual/html_node/Field-Separators.html#Fie= ld-Separators ciao... don > > Real example: > > I have a log file with the following output: > 2006-01-20 - 20:01:07 - Some text > 2006-01-20 - 20:01:15 - Some text > 2006-01-20 - 20:01:38 - Some text > (...) > > and since I'm generating hourly stats I need to match the "20" which is in > a string "20:01:07" that is separated by the char ":". > > I hope I've been clear. > > Thanks for your help. > _______________________________________________ > freebsd-questions@freebsd.org mailing list > http://lists.freebsd.org/mailman/listinfo/freebsd-questions > To unsubscribe, send any mail to > "freebsd-questions-unsubscribe@freebsd.org" =2D-=20 Don Hinton tel: 615.480.5667 ISIS, Vanderbilt University skype: donhinton http://people.vanderbilt.edu/~don.hinton/ --nextPart2029823.R1IqImfhSs Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.2 (FreeBSD) iD8DBQBD0XAB0U0xbM5cLs0RAj0mAJ9R98okWZ/XiAs0yeIhzNrVOOXlwgCgwURM L9KZx6YmMxAgENEMPVLLDCw= =Uoxw -----END PGP SIGNATURE----- --nextPart2029823.R1IqImfhSs--