column command examples

column command examples

column – columnate lists

In the below example, the lines starting with # are removed from “/etc/fstab”  using “sed” and the output is sent to the column to convert the tab-separated data into a table format.

[root@electronproton ~]# sed 's/#.*//' /etc/fstab | column -t 
/dev/mapper/cl-root                       /       xfs    defaults 0 0
UUID=4f014353-3241-4759-a71d-64b908963f71 /boot   xfs    defaults 0 0
/dev/mapper/cl-swap                       swap    swap   defaults 0 0

 

 

Leave a Reply

Your email address will not be published. Required fields are marked *