Sunday, November 2, 2014

Command of the day: column

Often I come across a new command which I think Wow! I always wanted to know how to do that.

I decided that I will blog about them and that way I will have a record for next time when I forget how to do it.

So my first command of the day I is one I saw on a Red Hat post. It can show the contents of a file tabulated into easy to read columns.

Example:
cat /etc/passwd | column -s : -t


Now you are probably aware of the <tab> character, often entered as \t or in bash as $'\t'. It will advance the cursor to the next tab stop which is traditionally every 8 characters. Well what if you have a tab delimited file but some data is longer than 8 characters and some it less. Well when you look at it, the output will be all over the place.

Using column you can get all your tab columns to line up like this:
cat data | column -s $'\t' -t
Note: for this to work correctly you must have a value in every column (perhaps a bug?)

22 comments:

  1. I think this is an informative post and it is very useful and knowledgeable. I really enjoyed reading this post gmail login

    ReplyDelete
  2. Nice, Great website Thanks For Sharing
    Angelina

    ReplyDelete
  3. I wanted to thank you for this excellent read!! I definitely loved every little bit of it
    - slope game -

    ReplyDelete
  4. Thanks for sharing happy wheels these tips, these tips are very helpful and useful.

    ReplyDelete
  5. Good article and knowledge for me! I found a lot of information here! This article is really good for all newbie here. Thank you for sharing with us!
    asianfanfics

    ReplyDelete
  6. This is extremely helpful info!! Very good work. Everything is very interesting to learn and easy to understood. Thank you for giving information.

    run 3

    ReplyDelete
  7. The article you have shared here very awesome. I really like and appreciated your work. I read deeply your article, the points you have mentioned in this article are useful
    Get On Top

    ReplyDelete
  8. Thanks for sharing us a great information that is actually helpful
    friv 4 school

    ReplyDelete
  9. Excellent post. Keep writing such kind of info on your blog. Im really impressed by your blog.
    fnaf games

    ReplyDelete
  10. The information you share is very interesting.
    @ashleyjordae

    ReplyDelete
  11. Thank for your writting. You have made it very clear that the problem is happening. I really like your way of thinking return man

    ReplyDelete
  12. When I'm sad I usually play games. It will make me more comfortable. I like to spend time like that
    happy wheels

    ReplyDelete

  13. عندما تستعين بــ شركة تنظيف شقق بالرياض متخصصة في عمل التنظيف الخاصة عندما تكون الشركة لها سمعة طيبة في مجال التنظيف ستحصل على منزل براق وأرضيات و حوائط نظيفة تماما مع الحفاظ على ألوانها من مواد التنظيف لنظافة شيئا ضروريا وخاصة عند تواجد اطفال صغار يخشي عليهم من الاتربة شركة تنظيف موكيت بالرياض _ شركة تنظيف مجالس بالرياض _ شركة تنظيف كنب بالرياض _ شركة تنظيف واجهات بالرياض

    ReplyDelete
  14. This is really a great stuff for sharing. Keep it up .Thanks for sharing.
    http://hotmailloginm.com/

    ReplyDelete
  15. Thanks a lot for the post. It has helped me get some nice ideas. I hope I will see some really good result soon.
    hotmail login

    ReplyDelete
  16. I personally like your post, you have shared good article. It will help me in great deal.
    http://gmailloginm.co/gmail-sign-up/

    ReplyDelete

  17. Thanks for Nice and Informative Post. This article is really contains lot more information about This Topic gmail sign up

    ReplyDelete

  18. Thanks a lot for the post. It has helped me get some nice ideas. I hope I will see some really good result soon.
    gmail sign up

    ReplyDelete