[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

expand (1) not useful enough. How about expandest?



Hello. I often create spreadsheet in spreadsheet software (gnumeric, oocalc) and save as Tab-separated value, convert to text format, send it as plain text in email body. Because I hate to require the other person to use spreadsheet software if I just want to present a simple table of less than 5 columns to them.

This way you can imagine I use expand(1) a lot. To expand tab-separated text table to plain-text-formatted-with-space.

But
  1. expand require me to know the column width
  2. and each column width must be the same
So this is what I do:
  • The widest column I have is column 4.
  • The widest cell in column 4 is row 3, it is 12 characters wide.
  • expand -t 12
I always want a tool that:
  • Check the whole data file, for each column, find the widest cell.
  • expand the data file, use widest cell for each column.
  • it should know one ideograph counts two characters wide.
question: is there such a tool? Or do I have to write it myself (using awk)? If I wrote such a tool, I'll call it "expendest", because it expends according to widest data cells in each column.

Thanks.

Best.
Zhang Weiwu

Reply to: