Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I just want an easy way to columnize output to the terminal.

  • Don't care about colors. (Well, actually I do quite a bit! But there is the awesome, easy-to-use ANSI Color for that.)
  • Shell scripts preferred, but anything easy-to-use will do.
  • Flexible solutions preferred, but the simple case I'd love to solve is just looking through text line-by-line, looking for the first occurrence of a separator (say, the equals sign, or maybe a comma), and separate everything on either side of that character into its own column.
share|improve this question
add comment

1 Answer 1

up vote 8 down vote accepted

Use the column command:

rpinson@rpinson:~$ mount | column -t
/dev/sda1         on  /                         type  ext3                   (rw,errors=remount-ro)
proc              on  /proc                     type  proc                   (rw,noexec,nosuid,nodev)
none              on  /sys                      type  sysfs                  (rw,noexec,nosuid,nodev)
none              on  /sys/kernel/debug         type  debugfs                (rw)
none              on  /sys/kernel/security      type  securityfs             (rw)
none              on  /dev                      type  devtmpfs               (rw,mode=0755)
none              on  /dev/pts                  type  devpts                 (rw,noexec,nosuid,gid=5,mode=0620)
none              on  /dev/shm                  type  tmpfs                  (rw,nosuid,nodev)
none              on  /var/run                  type  tmpfs                  (rw,nosuid,mode=0755)
none              on  /var/lock                 type  tmpfs                  (rw,noexec,nosuid,nodev)
none              on  /lib/init/rw              type  tmpfs                  (rw,nosuid,mode=0755)
binfmt_misc       on  /proc/sys/fs/binfmt_misc  type  binfmt_misc            (rw,noexec,nosuid,nodev)
gvfs-fuse-daemon  on  /home/rpinson/.gvfs       type  fuse.gvfs-fuse-daemon  (rw,nosuid,nodev,user=rpinson)
share|improve this answer
    
That was easy!! –  Linker3000 Jun 8 '11 at 14:47
    
But beautiful :D –  Pitto Jun 8 '11 at 16:33
    
Holy crap …that WAS easy! ☺ I can’t believe I haven’t heard of this awesome little program before. You, @Raphink , rock. –  Zearin Jun 10 '11 at 12:44
add comment

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.