4

According to man column:

 -x      Fill columns before filling rows.

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

balki
  • 4,407
  • 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. – PersianGulf Oct 10 '13 at 23:35

2 Answers2

7

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
slm
  • 369,824
iruvar
  • 16,725
  • 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. – Runium Oct 11 '13 at 00:28
5

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
Runium
  • 28,811