From owner-freebsd-questions@FreeBSD.ORG Sun Nov 2 04:17:54 2008 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 977131065675 for ; Sun, 2 Nov 2008 04:17:54 +0000 (UTC) (envelope-from the.real.david.allen@gmail.com) Received: from wf-out-1314.google.com (wf-out-1314.google.com [209.85.200.173]) by mx1.freebsd.org (Postfix) with ESMTP id 6A29B8FC0A for ; Sun, 2 Nov 2008 04:17:54 +0000 (UTC) (envelope-from the.real.david.allen@gmail.com) Received: by wf-out-1314.google.com with SMTP id 24so1931570wfg.7 for ; Sat, 01 Nov 2008 21:17:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from:to :subject:cc:in-reply-to:mime-version:content-type :content-transfer-encoding:content-disposition:references; bh=X+DriBB74vhn6MZuZAiiHD8WfsDDf+QaHtTCrwxlRlc=; b=Mg4IGAIJM0WZbPmmziGCZWsif4tRSGcd9spLesNdeJBLOoNAv1O8X8rcfF/etyDdjv OEkslVowEW+aMRos7rtGm1t5WE4cPLtKkUgiS1SfV/dyGJ6WoWLvnx6IPafunlIL2VQF pj8C1ieyrw421tQi8RKSo6jfhHUtksGeCh7pU= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:to:subject:cc:in-reply-to:mime-version :content-type:content-transfer-encoding:content-disposition :references; b=I6kgDubTwmxMA5A+ioNwVHpDgnJ0+LTu5jVU5VuDwvjUeKuyEueyFfRIB8CYEy9NbT ifOYHOYVhc3g7bCvMfltYo+aCUgNVYJYWXbxZ/em+gN5NXY5ns0h3Q3n4gOtaHUfouLc FAwOXVmKn85knkOSpr/8L46jWBXPV784Soo38= Received: by 10.142.251.9 with SMTP id y9mr6411945wfh.46.1225599474073; Sat, 01 Nov 2008 21:17:54 -0700 (PDT) Received: by 10.143.18.2 with HTTP; Sat, 1 Nov 2008 21:17:54 -0700 (PDT) Message-ID: <2daa8b4e0811012117i5d3f30d3w9ea927679cb5e7b1@mail.gmail.com> Date: Sat, 1 Nov 2008 20:17:54 -0800 From: "David Allen" To: "Jeremy Chadwick" In-Reply-To: <20081102020344.GA80530@icarus.home.lan> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline References: <2daa8b4e0811011821q210ae3a5j8f612a0fc79e8844@mail.gmail.com> <20081102020344.GA80530@icarus.home.lan> Cc: freebsd-questions@freebsd.org Subject: Re: OT: Shell Script using 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: Sun, 02 Nov 2008 04:17:54 -0000 On 11/1/08, Jeremy Chadwick wrote: > On Sat, Nov 01, 2008 at 06:21:55PM -0700, David Allen wrote: >> My apologies for asking on this list, but I'm stuck without Perl and need >> to use awk to generate a report. >> >> I'm working with a large data set spread across multiple files, but to >> keep things simple, say I have A Very Long String that containing records, >> each delimited by a single space. I need to print those records in >> columnar format, but with only 7 columns per line: >> >> record1 record2 record3 record4 record5 record6 record7 >> record08 record09 record10 record11 record12 record13 record14 >> ... >> >> Should be simple, but I'm getting nowhere. > > $ cat input > col1 col2 col3 col4 col5 col6 col7 col8 col9 col10 col11 col12 col13 col14 > > $ cat output.awk > { > print $1 " " $2 " " $3 " " $4 " " $5 " " $6 " " $7 > print $8 " " $9 " " $10 " " $11 " " $12 " " $13 " " $14 > } > > $ cat intput | awk -f output.awk > col1 col2 col3 col4 col5 col6 col7 > col8 col9 col10 col11 col12 col13 col14 Thanks for the reply, Jeremy, but that approach would require an entirely manual approach, which isn't suitable for what I'm working with. Writing a script that's the same size as the data I'm working with isn't an option. ;-)