When I type this column command with my input file I get the following error
column -t text.txt > output
column: line too long
column: line too long
column: line too long
column: line too long
column: line too long
column: line too long
When I look at the file output it seems that the first half of the file(from left to right) is not printed.
Is there a way around this error? Is there a way to do exactly what the command would do otherwise without this error?
Sample input (Real input ~640 columns)
column1 column2 column3 column4
03  2   45  3
5   6   7   8
Sample output (Real output ~640 columns)
column1    column2  column3  column4
03         2        45       3
5          6        7        8
                You could try a naive awk implementation:
awk 'NR==FNR{for(i=1;i<=NF;i++) 
        max[i] = length($i) > max[i] ? length($i) : max[i]; next} 
{ for(i=1;i<=NF;i++) printf "%-"max[i]"s  ", $i; printf "\n"}' text.txt text.txt
                        An alternative is to split the line into an array.
This line is too long and column will not print it in full:
FULLTEXT=$(cat /Users/burroughclarke/Desktop/commaseperatedvalues.csv)
printf "$FULLTEXT" | column  -t -s ','
This prints it properly:
readarray -t ARR < <(cat /Users/burroughclarke/Desktop/commaseperatedvalues.csv | tr "\n" "\n") 
printf '%s\n' "${ARR[@]}" | column  -t -s ','
                        If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With