Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

According to man column:

 -x      Fill columns before filling rows.

This option doesn't seem to do anything. Any idea how to use it?

share|improve this question
    
i suggest search for type of -x option and type of your machine. for example, grep has a set of GNU Extension that other machine can't support them such as -C -B and -A. –  Mohsen Pahlevanzadeh Oct 10 '13 at 23:35

2 Answers 2

up vote 4 down vote accepted

This comes into play with the -c Output is formatted for a display columns wide. option. Best explained with an example

cat test.file2
1 a b c d e f g h
2 a b c d e f g h
3 a b c d e f g h
4 a b c d e f g h
5 a b c d e f g h
6 a b c d e f g h

When output is formatted for a display 80 columns wide, column fills out the rows first

column -c 80 test.file2 
1 a b c d e f g h       3 a b c d e f g h       5 a b c d e f g h
2 a b c d e f g h       4 a b c d e f g h       6 a b c d e f g h

When the -x Fill columns before filling rows. option is passed, the opposite happens

column -c 80 -x test.file2 
1 a b c d e f g h       2 a b c d e f g h       3 a b c d e f g h
4 a b c d e f g h       5 a b c d e f g h       6 a b c d e f g h
share|improve this answer
    
If -c option is not given it uses ioctl() to get TIOCGWINSZ, if that fails it reads COLUMNS environment variable, if that fails it uses 80 as fall-back. The -c option can be used to override this. –  Sukminder Oct 11 '13 at 0:28

Order of filling:

$ cat col
01 02 03 04 05 06 07
08 09 10 11 12 13 14 
15 16 17 18 19 20 21 
22 23 24 25 26 27 28 
29 30 31 32

$ column col
01 02 03 04 05 06 07    15 16 17 18 19 20 21    29 30 31 32
08 09 10 11 12 13 14    22 23 24 25 26 27 28 

$ column -x col
01 02 03 04 05 06 07    08 09 10 11 12 13 14    15 16 17 18 19 20 21 
22 23 24 25 26 27 28    29 30 31 32

Which also can affect number of rows/columns:

$ column col
01 02 03 04    13 14 15 16    25 26 27 28    37 38 39 40
05 06 07 08    17 18 19 20    29 30 31 32    41
09 10 11 12    21 22 23 24    33 34 35 36

$ column -x col
01 02 03 04    05 06 07 08    09 10 11 12    13 14 15 16    17 18 19 20 
21 22 23 24    25 26 27 28    29 30 31 32    33 34 35 36    37 38 39 40
41
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.