[colug-432] Nice Plain Text Columns and Avoiding NIH

William Yang wyang at gcfn.net
Mon Aug 8 10:00:52 EDT 2011


On 08/08/2011 05:47 AM, jep200404 at columbus.rr.com wrote:
> Let's start over. 
>
> On Sun, 7 Aug 2011 22:16:18 -0400, Jeff Frontz <jeff.frontz at gmail.com> wrote:
>
>> Maybe I'm misunderstanding what it is that you want, ... 
> You are not the only one to misunderstand what I want. 

Actually, I'm becoming concerned that you may not understand what you
want.  The problem you've described is so deeply into the sweet spot of
the 'awk' family of text processors that it's difficult to understand
why you're so adverse to it.

What you're running into seems to be a paradigm shift: I'm not aware of
much that was designed ONLY what you're doing.  The problem has been
solved much more generally (in keeping with the overall design
philosophy of UNIX systems and the line of descendants such as Linux). 

Awk's syntax looks a lot like C (AWK is an acronym made of the original
authors' names... the K is Kernigan, as in Brian Kernigan, one of the
two creators of the C language. 

You're going to need to write a little scripting glue (in the form of
AWK) to do what you're looking for, but it's probably the best possible
fit to your problem short of writing a custom tool yourself in C.



> First of all, I am _not_ asking how to make a program, 
> or about techniques for making a program. 
> For decades, I have known many ways to make such a program. 
> I was trying to avoid writing such a program altogether. 
> Instead I was wanting to know of an already existing program 
> that someone else had written. 
>
> Here's what I am looking for. 
>
> A _pre-existing_ program that: 
>     o   is a classic plain text filter
>     o   uses tabs to delimit input fields (columns)
>     o   echoes the input, replacing tabs with enough spaces so 
>         as to make the fields line up in nice columns
>         o   each column would only get as much space as it 
>             needs to line up nice                   
>             (program would have to read all input to figure 
>             output width of each field, before outputting 
>             anything)
>         o   output columns would be separated with a single ' '
>
> or more fancily: 
>
> A _pre-existing_ program that: 
>     o   is a classic plain text filter
>     o   uses tabs to delimit input fields (columns)
>         (option to specify arbitrary delimiter would be nice)
>     o   echoes the input, replacing tabs with spaces so 
>         as to make the fields line up in nice columns
>         o   each column would only get as much space as it 
>             needs to line up nice                   
>             (program would have to read all input to figure 
>             output width of each field, before outputting 
>             anything)
>             (would be nice to have option to limit width of 
>             particular output columns)
>             (would be nice to have option to specify minimum 
>             width for particular output columns)
>         o   output columns would be separated with a single ' '
>             (option to specify other separator would be nice)
>
> _______________________________________________
> colug-432 mailing list
> colug-432 at colug.net
> http://lists.colug.net/mailman/listinfo/colug-432
>



More information about the colug-432 mailing list