From owner-freebsd-questions@FreeBSD.ORG Sun Nov 2 02:03:47 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 109021065675 for ; Sun, 2 Nov 2008 02:03:47 +0000 (UTC) (envelope-from jdc@koitsu.dyndns.org) Received: from QMTA04.emeryville.ca.mail.comcast.net (qmta04.emeryville.ca.mail.comcast.net [76.96.30.40]) by mx1.freebsd.org (Postfix) with ESMTP id DCABA8FC0C for ; Sun, 2 Nov 2008 02:03:46 +0000 (UTC) (envelope-from jdc@koitsu.dyndns.org) Received: from OMTA05.emeryville.ca.mail.comcast.net ([76.96.30.43]) by QMTA04.emeryville.ca.mail.comcast.net with comcast id Znul1a00W0vp7WLA423mKD; Sun, 02 Nov 2008 02:03:46 +0000 Received: from koitsu.dyndns.org ([69.181.141.110]) by OMTA05.emeryville.ca.mail.comcast.net with comcast id a23k1a00M2P6wsM8R23kq6; Sun, 02 Nov 2008 02:03:45 +0000 X-Authority-Analysis: v=1.0 c=1 a=QycZ5dHgAAAA:8 a=4h6gg2VM1-ui3QngywoA:9 a=1JElvEDNCGOe8DxNibGBXcMXRL8A:4 a=EoioJ0NPDVgA:10 a=LY0hPdMaydYA:10 Received: by icarus.home.lan (Postfix, from userid 1000) id 564C4C9419; Sat, 1 Nov 2008 19:03:44 -0700 (PDT) Date: Sat, 1 Nov 2008 19:03:44 -0700 From: Jeremy Chadwick To: David Allen Message-ID: <20081102020344.GA80530@icarus.home.lan> References: <2daa8b4e0811011821q210ae3a5j8f612a0fc79e8844@mail.gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <2daa8b4e0811011821q210ae3a5j8f612a0fc79e8844@mail.gmail.com> User-Agent: Mutt/1.5.18 (2008-05-17) 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 02:03:47 -0000 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 -- | Jeremy Chadwick jdc at parodius.com | | Parodius Networking http://www.parodius.com/ | | UNIX Systems Administrator Mountain View, CA, USA | | Making life hard for others since 1977. PGP: 4BD6C0CB |