![]() |
→ | ![]() |
About Entable
Entable is a plug-in for BBEdit and TextWrangler that lines up columns of text into tables.
Download
Version history
v1.0 (09/20/05) - Initial public release
v1.1 (09/27/05) - Minor updates to the help documentation; adjusted help so that "-h" gives condensed help, and "-help" gives full help; also fixed a bug with decimal alignments
v1.2 (09/29/05) - Documentation fix for "\\" option; slight improvements for using "-h" and "-help" within BBEdit/TW windows; also now resets to the default settings for each START/END block instead of retaining settings throughout a document across blocks
v1.3 (11/26/06) - Minor documentation fix, slightly improved comment handling, and bugfix with documentation display at command line
Installing Entable
BBEdit Users:
Drag Entable to <user>/Library/Application Support/BBEdit/Unix Support/Unix Filters
TextWrangler Users:
Drag Entable to <user>/Library/Application Support/TextWrangler/Unix Support/Unix Filters
... and for one-keystroke access
Try binding Entable to a keystroke (such as CTRL-T). To do this, in BBEdit/TextWranger go to Window:Palettes:Unix Filters, select "entable", then click the "Set Key..." button and type the keystroke you want to use.
Using Entable
Quick start -- Auto mode -- Manual mode -- Saving Settings -- At the terminal
Quick start
Entable is a "unix filter", so it is run from the #!:Unix Filters menu in BBEdit or TextWrangler. It will entable the selected text, or the whole document if nothing is selected.
Entable has two modes, auto (which is the default) and manual.
To see it work, copy these lines into a new BBEdit window, then run entable:
Star HD* Vis_Mag. Light_years
a 81797 1.98 89
b 103192 4.28 270
g 115659 3.00 110
d 73262 4.16 99
e 74874 3.38 120
z 76294 3.11 93
To see auto mode in action, try adjusting the spacing to the right and left of the "Star" and "HD*" words on the first line, then re-run entable.
By default, entable lines up the columns based on the spacing of the first three columns in the first row (see auto mode below). For better control, use manual mode.
Auto mode
In "auto" mode, which is the default, use spaces to arrange the first three columns of the first row like you'd like them, then run Entable.

For example:
![]() |
→ | ![]() |
Note, commented lines (lines that start with "#" or "//") aren't entabled. Each time the filter is run, it uses the spacings between the first three columns as the minimum spacings desired -- so if the filter is applied over and over, the columns may get spaced farther apart each time.
Manual mode
Manual mode is much more powerful.

Entable operates in auto mode until it sees a command, which is any line that looks like one of these:
entable <options>
// entable <options>
# entable <options>
(Or for you regex-perts: /\s*(#|//)?\s*entable/i )
<options> is just a space delimited list of commands. The following are some examples; a list of all the available commands are further down.
- Some examples:
- entable -s 2
- Output a minimum of two spaces between columns, all left justified
- entable -s 2:3
- Output a minimum of two spaces between all columns except for columns 1 and 2 where you want 3, all left justified
- entable -t
- Output spaces enough to pad the column, then tab between columns, all left justified
- entable -ts
- Line up and left justify columns using only tabs
- entable -t INTAB
- Line up and left justify columns using only tabs, columns are delimited by a single tab
- entable -s2:3:5
- Output 2 spaces between all columns except 1 and 2, where you want 3, and insert 5 spaces before each line
- entable -s2 [lrr.]
- Output 2 spaces between all columns; left justify column 1, right justify columns 2 and 3, and decimal justify column 4 (and 5, 6, 7...)
- Some text up here...
# entable START
1234 a b c
123 d
12 e
1 f
# entable END
... and more text. - Only entable the data between start and end tags.
The default settings string for entable is:
ENTABLE auto -d ' ' -tab 4 -D ' ' -p2:3:0 OFF tsflag0 -ext .entable [l]
Options
- Input Delimiters
- INWS
- Input columns are delimited by whitespace (default).
- INTAB
- Input columns are delimited by a single tab (two tabs next to each other is seen as a blank column).
- INTABS
- Input columns are delimited by one or more tabs.
- INCOMMA
- Input columns are delimited by a single comma.
- -d 'delimiter'
- Use a custom input delimiter
- Output Delimiters
- OUTSPACE, or -s #1:#2:#3
- Output columns are delimited by spaces (default); all numbers are optional:
#1 = min. number of spaces between columns,
#2 = min. number of spaces between columns 1 and 2,
#3 = number of spaces before first column - OUTTAB, or -t #1:#2:#3:#4
- Output columns are delimited by spaces, then a single tab; all numbers are optional:
#1 = number of spaces a tab represents in BBEdit/TextWrangler
#2 = min. number of tabs between columns,
#3 = min. number of tabs between columns 1 and 2,
#4 = number of tabs before first column - OUTTABS, or -ts #1:#2:#3:#4
- Output columns are delimited by multiple tabs (i.e. uses multiple tabs instead of spaces to pad the columns); all numbers are optional:
#1 = number of spaces a tab represents in BBEdit/TextWrangler
#2 = min. number of tabs between columns,
#3 = min. number of tabs between columns 1 and 2,
#4 = number of tabs before first column - -D 'delimiter'
- Use a custom output delimiter
- tsflag#
- Set whether tabs (tsflag1) or spaces (tsflag0) are used to fill in the extra space when using -D '\t'
- -tab number
- Specify number of spaces a tab represents in BBEdit/TextWrangler
- -p #1:#2:#3
- Specify number of output delimiters between columns (does not set the output delimiter like -s and -t do); all numbers are optional:
#1 = min. number of output delimiters between columns,
#2 = min. number of output delimiters between columns 1 and 2,
#3 = number of output delimiters before first column
- Control
- START
- Denotes start of block to be entabled.
- END
- Denotes end of block to be entabled.
-
Note, multiple blocks can be defined within a single document.
- Column Alignment
- [string of alignment tokens]
- Aligns columns in order according to the alignment tokens (see Alignment Tokens next)
-
Note: if there are more columns than tokens, entable uses the last token for the rest of the columns.
- Alignment Tokens
- L
- Left alignment
- R
- Right alignment
- D, or .
- Decimal alignment
- C, or E
- Center alignment
- N
- No alignment for rest of line; this is useful when your last column has a comment or other string of text you don't want aligned
- Zero padding
- PRE
- Pads numbers with zeroes to the left of the decimal.
- POST
- Pads numbers with zeroes to the right of the decimal.
- BOTH
- Pads numbers with zeroes to the left and right of the decimal.
- OFF
- No zero padding (default).
- Auto and Manual mode
- AUTO
- Use auto mode (which is the default); supplying any other commands causes entable to switch to manual mode
-
"AUTO" lets you use auto mode for part of a file (denoted by the "START" and "END" tags), and manual mode in other parts.
Saving settings
Entable lets you save your settings as the defaults, e.g.:
# entable INTABS -s 2:3 savesettings
Entable saves the settings in your home directory in the file ".entable-cfg". To clear your settings, either delete that file, or open a new document, type:
entable clearsettings
... and run entable. This will delete the config file, and revert to using the defaults.
- Saving and Clearing Settings
- SAVESETTINGS or savesettings
- Writes settings to ~/.entable-cfg
- CLEARSETTINGS or clearsettings
- Removes ~/.entable-cfg file, reverting to entable's defaults
By the way, Entable ignores case when it's reading commands, so "AUTO" and "auto" mean the same thing.
At the terminal
By the way, Entable was designed to run at the command line too. If you pass it a list of files, it will process them all just like it does in BBEdit/TextWrangler, except that it writes them to ".entable" files:
% entable *.txt
1. myfile-a.txt --> myfile-a.txt.entable
2. myfile-b.txt --> myfile-b.txt.entable
3. myfile-c.txt --> myfile-c.txt.entable
4. myfile-d.txt --> myfile-d.txt.entable
You just need to make sure entable is in your path. I suggest moving the file to /usr/local/bin and making a soft-link in the BBEdit/TextWrangler Unix Filters folder.
- Command line switches
- All commands above, e.g. -s4:3, can be supplied at the command line, as well as the following:
- -f
- Force writing to file -- entable writes to STDOUT if only one file is supplied so that it can be used as a BBEdit/TextWrangler filter. -f causes it to always write to a file.
- -r
- Overwrites the original files -- use with caution
- -ext extension
- Use extension as the outfile extension
- -h
- Show help at the command line
- -hist
- Show version history
License, Caveats
I hope entable does exactly what you want it to, but of course you use this software at your own risk without warranties -- for questions or support, email me at the address below. If something bad happens, first try "Undo".
Commercial use (i.e. stealing entable code and selling it to someone else) without written consent is prohibited. (Did I have to say that?)
Entable is "lunchware" -- if you think it's worth anything, you can buy me lunch through Paypal:
Copyright © 2006, Bryan Harris



