From owner-freebsd-questions@FreeBSD.ORG Fri Jan 20 23:25:49 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 1C98216A41F for ; Fri, 20 Jan 2006 23:25:49 +0000 (GMT) (envelope-from nullpt@gmail.com) Received: from uproxy.gmail.com (uproxy.gmail.com [66.249.92.194]) by mx1.FreeBSD.org (Postfix) with ESMTP id 5107043D46 for ; Fri, 20 Jan 2006 23:25:48 +0000 (GMT) (envelope-from nullpt@gmail.com) Received: by uproxy.gmail.com with SMTP id j3so34871ugf for ; Fri, 20 Jan 2006 15:25:47 -0800 (PST) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:to:subject:in-reply-to:mime-version:content-type:references; b=RAURrnKZBpyPRlfIhCYG8boTYX02epBq1FOcAeakzffq8p64dTeXiX47xcHN71aibObYxRKcRf3YerTgW1FqGylL3D1nGjWWqEOxbILpYOqhI92McxcloOkGPq3k42UEakzi5zj40QTNnH8JHhycAVnskXF5ksnUJgDHODLZ8lI= Received: by 10.48.108.7 with SMTP id g7mr187672nfc; Fri, 20 Jan 2006 15:25:47 -0800 (PST) Received: by 10.49.41.1 with HTTP; Fri, 20 Jan 2006 15:25:46 -0800 (PST) Message-ID: <755cb9fc0601201525x6892a40dte1b50f271c6958dd@mail.gmail.com> Date: Fri, 20 Jan 2006 23:25:46 +0000 From: Alexandre Vieira To: freebsd-questions@freebsd.org In-Reply-To: <200601201719.29153.don.hinton@vanderbilt.edu> MIME-Version: 1.0 References: <755cb9fc0601201459v643bf464i892ef3efc68dc788@mail.gmail.com> <200601201719.29153.don.hinton@vanderbilt.edu> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline X-Content-Filtered-By: Mailman/MimeDel 2.1.5 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:25:49 -0000 On 1/20/06, Don Hinton wrote: > > 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 > seperators... > > > http://www.gnu.org/software/gawk/manual/html_node/Field-Separators.html#F= ield-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" > > -- > Don Hinton tel: 615.480.5667 > ISIS, Vanderbilt University skype: donhinton > http://people.vanderbilt.edu/~don.hinton/ > > > Geez I can believe it was that easy. Thank you. -- Alexandre Vieira - nullpt@gmail.com