From owner-freebsd-questions@FreeBSD.ORG Fri Jan 20 22:59:24 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 9CBD116A41F for ; Fri, 20 Jan 2006 22:59:24 +0000 (GMT) (envelope-from nullpt@gmail.com) Received: from uproxy.gmail.com (uproxy.gmail.com [66.249.92.201]) by mx1.FreeBSD.org (Postfix) with ESMTP id 2A4FA43D64 for ; Fri, 20 Jan 2006 22:59:17 +0000 (GMT) (envelope-from nullpt@gmail.com) Received: by uproxy.gmail.com with SMTP id o2so177445uge for ; Fri, 20 Jan 2006 14:59:16 -0800 (PST) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:to:subject:mime-version:content-type; b=RYqG6M3GgwVBYaSHpyhBEYr4xBN7pz/CsnMqPoz8SenM8zGYplzfT8/FN8eaP6dAmnPaggo53vGxySfdaLD5JTJ3+qUoeabJFt/nyzJzLq6wfOd3H1PmSa0drY2AlH8dmIkc9RLndES/i/4Nb+jq4DTu26SxT/jqYi1gCNoFCYw= Received: by 10.49.20.12 with SMTP id x12mr187947nfi; Fri, 20 Jan 2006 14:59:16 -0800 (PST) Received: by 10.49.41.1 with HTTP; Fri, 20 Jan 2006 14:59:16 -0800 (PST) Message-ID: <755cb9fc0601201459v643bf464i892ef3efc68dc788@mail.gmail.com> Date: Fri, 20 Jan 2006 22:59:16 +0000 From: Alexandre Vieira To: freebsd-questions@freebsd.org MIME-Version: 1.0 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: 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 22:59:24 -0000 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? 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.