Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 2 Apr 2001 02:50:02 -0700 (PDT)
From:      Peter Pentchev <roam@orbitel.bg>
To:        freebsd-bugs@FreeBSD.org
Subject:   Re: bin/26283: column coredumps on specific input
Message-ID:  <200104020950.f329o2435401@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help
The following reply was made to PR bin/26283; it has been noted by GNATS.

From: Peter Pentchev <roam@orbitel.bg>
To: Steven Enderle <enderle@mdn.de>
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




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200104020950.f329o2435401>