7

I have a (3-columns) TAB-delimited file, such as:

activity_log    manager Manager
reserve_rm_hreserver_rm_log manager Manager
mo  apprv_mgr1  Approving Manager
wrview  manager Manager

I'd like to get columns correctly aligned; in this case:

activity_log                  manager      Manager
reserve_rm_hreserver_rm_log   manager      Manager
mo                            apprv_mgr1   Approving Manager
wrview                        manager      Manager

No doubt this is doable with awk, by scanning the longest string in every column, and using that for formatting the column printing. I could do that.

But I'm sure there must be a one-liner to do that much more easily. Am I right?

1
  • 2
    column -t file should do it Commented Feb 4, 2016 at 11:12

1 Answer 1

5

This should work:

$ column -t myfile.txt

you can use different chars to fill (man column is your friend)

Sign up to request clarification or add additional context in comments.

1 Comment

With -s '<TAB character>', that's what I was after. Thx a lot!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.