New answers tagged

0

I tested these command on Linux Debian in the terminal. If your terminal is wide enough, just stating "ls" will give columns but it won't use all the space (width) of the terminal. I made the terminal as wide as the screen and "ls" just produced 4 columns. Problem is if you pipe this into "more" you loose the columns. Next I used "ls -w200" in the ...


2

Here's a shorter answer that uses fold then shifts its output by 11 spaces. To see what it is doing add a -v or -x to the final bash. | sed 's:\(.*\)---\(.*\):printf "%-10s " "\1";fold -w '$(($COLUMNS - 11))' -s <<\\!|sed "1!s/^/ /"\n\2\n!\n:' | bash


3

With gnu awk you can do something simple like this: awk -F '---' ' { gsub(/.{50,60} /,"&\n ",$2) printf "%-10s %s\n", $1, $2 }' For a more accurate long-winded version handling long words: awk -F '---' ' { printf "%-10s ", $1 n = split($2,x," ") len = 11 for(i=1;i<=n;i++){ if(len+length(x[i])>=80){printf "\n "; ...



Top 50 recent answers are included