The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Dummies Questions & Answers
Google UNIX.COM


UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !!

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Building Full-Text Search Applications with Oracle Text iBot Oracle Updates (RSS) 0 04-06-2008 02:10 AM
c program to extract text between two delimiters from some text file kukretiabhi13 High Level Programming 5 01-22-2008 02:42 AM
Copying Text between two unique text patterns spindoctor UNIX for Dummies Questions & Answers 2 05-28-2007 12:15 PM
text formating/Text space padding hugow UNIX for Dummies Questions & Answers 6 06-29-2005 06:49 AM
grep multiple text files in folder into 1 text file? coppertone UNIX for Dummies Questions & Answers 7 08-23-2002 11:50 AM

Reply
 
Submit Tools LinkBack Thread Tools Search this Thread Display Modes
  #1  
Old 01-09-2008
Registered User
 

Join Date: Jan 2008
Posts: 1
columnating text

I have a file /T, where the text of that file is:

1
2
3
4
5
6

I wish to change that to a two-column format

column </T --(output set to new document) gets:
1 2 3 4 5 6
which probably makes sense as I have no option and no argument.

column -c <T (output set to new document) yields nothing, which makes sense because I haven't specified an argument

column -c 2 </T -- (output set to new document) I expect

1 2
3 4
5 6

BUT get

1
2
3
4
5
6

It would seem I'm specifying the argument incorrectly. If that's true, what is the proper syntax?

And, if I can get past the above problem, what's the story with an -x option; it doesn't appear in the "man column" I've looked at, but elsewhere I've seen it stated that (with that option) I should get:

1 4
2 5
3 6

help? TIA
Reply With Quote
Forum Sponsor
  #2  
Old 01-10-2008
Perderabo's Avatar
Unix Daemon
 

Join Date: Aug 2001
Location: Washington DC Area
Posts: 8,653
I have never used this command before, but there's a first time for everything. Playing around a little I get...
Code:
$ column -c20 < ./T
1       4
2       5
3       6
$ column -c20 -x < ./T
1       2
3       4
5       6
$
Reply With Quote
  #3  
Old 01-10-2008
drl's Avatar
drl drl is offline
Registered User
 

Join Date: Apr 2007
Location: Saint Paul, MN USA / BSD, CentOS, Debian, OS X, Solaris
Posts: 550
Hi.

I think the columns command is somewhat deceiving. The option "-c" does allow you to specify "columns", but it is the column-width of the display area, not "columns" of data.

A useful exercise might be to find the length of the file in lines, split the file, and use paste to read the splits -- provided the data fits into data-columns within the display-columns ... cheers, drl
Reply With Quote
Google The UNIX and Linux Forums
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes




All times are GMT -7. The time now is 12:42 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited.
The UNIX and Linux Forums Content Copyright ©1993-2008. All Rights Reserved.Ad Management by RedTyger Visit The Complex Event Processing Blog

Content Relevant URLs by vBSEO 3.2.0