Formatting text into columns

590 views
Skip to first unread message

Melissa

unread,
Dec 30, 2013, 8:51:10 AM12/30/13
to bbe...@googlegroups.com
Hi,

Does anyone know of a quick way to nicely format data into columns?

Say I have tabbed data like the following:

Fruit Colour Amount
Apple Green 2
Apple Red 31
Grapefruit Pink 1

There are two tabs between each bit of data, but in order to line the data up visually, the first three rows need three tabs before the colour column, and there needs to also be a third tab before "31" to make that amount line up.

I've Googled and seen mention of a program called "entable" which doesn't seem to work.

Is there anything obvious I'm missing anywhere? The data I'm working with can vary from 35 characters to 100+, so it would save quite a bit of time to find something to automate this... is there anything built in to BBEdit that can do it?

Thanks in advance,
Melissa

Ted Burger

unread,
Dec 30, 2013, 9:01:10 AM12/30/13
to bbe...@googlegroups.com
Melissa,

You do not tell us what the end use will be.
If you want them in columns then get rid of all extra tabs so that there is a single one between the text.
Now copy/paste into a word processor that has tab stops or into a spreadsheet and print without the grid lines.

Thanks,
Ted
***********************  Ted Burger  ****************************
t...@tobsupport.com      *********     www.tobsupport.com



--
This is the BBEdit Talk public discussion group. If you have a
feature request or would like to report a problem, please email
"sup...@barebones.com" rather than posting to the group.
Follow @bbedit on Twitter: <http://www.twitter.com/bbedit>
 
---
You received this message because you are subscribed to the Google Groups "BBEdit Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to bbedit+un...@googlegroups.com.
To post to this group, send email to bbe...@googlegroups.com.

Charlie Garrison

unread,
Dec 30, 2013, 9:14:49 AM12/30/13
to bbe...@googlegroups.com
Good morning,

On 30/12/13 at 5:51 AM -0800, Melissa <des...@gmail.com> wrote:

>Does anyone know of a quick way to nicely format data into columns?

I don't believe there is a native method any longer (used to a
be a plugin for it ages ago). But `column` command could be used
in a filter.

Create a new file with the following contents:

#!/bin/sh
column -t

Save the file in BBEdit's 'Text Filters' folder and then run the
filter on your file.

Eg. using your sample data, it outputs:

Fruit Colour Amount
Apple Green 2
Apple Red 31
Grapefruit Pink 1


Or if you really want the entable script; I found it here (my
copy is 7 years old, so grab the latest):

<http://entable.s3.amazonaws.com/index.html>


Charlie

--
Ꮚ Charlie Garrison ♊ <garr...@zeta.org.au>

O< ascii ribbon campaign - stop html mail - www.asciiribbon.org
http://www.ietf.org/rfc/rfc1855.txt

Melissa

unread,
Dec 30, 2013, 12:06:27 PM12/30/13
to bbe...@googlegroups.com
On Monday, December 30, 2013 2:01:10 PM UTC, T Burger wrote:
You do not tell us what the end use will be.
If you want them in columns then get rid of all extra tabs so that there is a single one between the text.
Now copy/paste into a word processor that has tab stops or into a spreadsheet and print without the grid lines.

Apologies -- the text is for use in a program (Basic+). I want to neaten it to make it easier to read when making changes to the program at a later date.

Thank you for taking the time to reply.

Melissa

Melissa

unread,
Dec 30, 2013, 12:28:54 PM12/30/13
to bbe...@googlegroups.com
On Monday, December 30, 2013 2:14:49 PM UTC, Charlie Garrison wrote:
On 30/12/13 at 5:51 AM -0800, Melissa <des...@gmail.com> wrote:

>Does anyone know of a quick way to nicely format data into columns?

I don't believe there is a native method any longer (used to a
be a plugin for it ages ago). But `column` command could be used
in a filter.

Create a new file with the following contents:

#!/bin/sh
column -t

Save the file in BBEdit's 'Text Filters' folder and then run the
filter on your file.

Eg. using your sample data, it outputs:

Fruit       Colour  Amount
Apple       Green   2
Apple       Red     31
Grapefruit  Pink    1

Thank you very much for this!

Or if you really want the entable script; I found it here (my
copy is 7 years old, so grab the latest):

<http://entable.s3.amazonaws.com/index.html>

 Thank you -- I'll download it and give it a try as well.

Melissa

Greg Shenaut

unread,
Dec 30, 2013, 10:37:48 AM12/30/13
to bbe...@googlegroups.com
Melissa: thanks for writing this question, because in doing so, you have turned me on to the entable script, which is really cool. Years ago, I had written a fairly simple C program to align columns, and I'll probably still use it, but entable is much more flexible. It can be used either on the command line or as a BBedit plugin. It appears to use spaces, not tabs, to adjust the columns (at least by default). I haven't had a chance to play with it much, but run “entable -help” (one dash only) to see the various options. Unless you need to do something pretty radical with column alignment, I suspect you'll be able to get there with entable.

Greg Shenaut

Robert A. Rosenberg

unread,
Dec 30, 2013, 6:24:17 PM12/30/13
to bbe...@googlegroups.com
At 01:14 +1100 on 12/31/2013, Charlie Garrison wrote about Re:
Formatting text into columns:

>Eg. using your sample data, it outputs:
>
>Fruit Colour Amount
>Apple Green 2
>Apple Red 31
>Grapefruit Pink 1

Also put a space after the tab before the 2 and the 1 so the align
with the 31 (ie: Are numeric aligned).

Garth Fletcher

unread,
Dec 30, 2013, 11:39:27 PM12/30/13
to bbe...@googlegroups.com
Many thanks for the entable link. Very nice!
--
Garth Fletcher

Reply all
Reply to author
Forward
0 new messages