From owner-freebsd-bugs Mon Apr 2 2:50:10 2001 Delivered-To: freebsd-bugs@hub.freebsd.org Received: from freefall.freebsd.org (freefall.freebsd.org [216.136.204.21]) by hub.freebsd.org (Postfix) with ESMTP id 8493B37B720 for ; Mon, 2 Apr 2001 02:50:02 -0700 (PDT) (envelope-from gnats@FreeBSD.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.11.1/8.11.1) id f329o2435401; Mon, 2 Apr 2001 02:50:02 -0700 (PDT) (envelope-from gnats) Date: Mon, 2 Apr 2001 02:50:02 -0700 (PDT) Message-Id: <200104020950.f329o2435401@freefall.freebsd.org> To: freebsd-bugs@FreeBSD.org Cc: From: Peter Pentchev Subject: Re: bin/26283: column coredumps on specific input Reply-To: Peter Pentchev Sender: owner-freebsd-bugs@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.org The following reply was made to PR bin/26283; it has been noted by GNATS. From: Peter Pentchev To: Steven Enderle Cc: freebsd-gnats-submit@FreeBSD.org Subject: Re: bin/26283: column coredumps on specific input Date: Mon, 2 Apr 2001 12:48:36 +0300 On Mon, Apr 02, 2001 at 11:24:47AM +0200, Steven Enderle wrote: > This still doesn't help me much ... maybe it is not bug related, more > user stupidy, > but i will show you what i want to do: > > The following few lines (take 100.000 more and you got what i am sitting > in front of) should be formated into two columns: > > --- snip --- > 90 4y 8289! 182 ! 464 ! ! > 90 4y 8289! 182 ! 464 ! ! > 90 4y 8289! 182 ! 464 ! ! > 90 4y 8289! 182 ! 464 ! ! > --- snip --- > > so that the result looks like this: > > --- snip --- > 90 4y 8289! 182 ! 464 ! !90 4y 8289! 182 ! 464 > ! ! > 90 4y 8289! 182 ! 464 ! !90 4y 8289! 182 ! 464 > ! ! > --- snip --- > > (printf '90 4y 8289! 182 ! 464 ! !\n90 4y 8289! 182 ! > 464 ! !\n90 4y 8289! 182 ! 464 ! !\n90 4y > 8289! 182 ! 464 ! !\n' will give you the sample i am > working with.) > > so i thought, column -c 2 should do it. ("-c Output is formatted > for a display columns wide.") [snip] > is column that buggy? or am i too stupid to handle column correctly? > is there any other easy way to do this? Uhh.. column(1) doesn't work that way. The '-c' option is meant to specify how many characters should there be in one line; think of a display 80 columns wide - that's what -c 80 would be. By putting -c 2 in there, you are telling column(1) that it should format its output for 2 chars per line; it finds that most lines are longer than 2 chars, so it just displays them as-is. If all your lines have a fixed width, you should probably use column with -c, but with a value just a bit more than twice your line width. However, your lines seem to be exactly 40 chars wide, which poses a problem - column(1) likes to add a tab between the columns. You might get away with something like: column -c 96 < yourfile | tr -d '\t' ..or.. column -c 96 < yourfile | perl -pe 's/!\t/!/g' (I couldn't figure out the sed(1) escape sequence for a tab). The 96 comes from 40 chars-line + tab = 48 chars.. to fit two of those on a line, you need 96 chars per line. Hope that helps.. G'luck, Peter -- No language can express every thought unambiguously, least of all this one. To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-bugs" in the body of the message