Mailing List Archive


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

Re: [tlug] "Windows is Free" stats: reformatted: How to Fish



> On 19/08/07, jep200404 <jep200404@example.com> wrote:
> Based on the quick-and-dirty nature of the thing, I think
> the amount of effort I put into it was about right.

I agree with this.  I am just replying in order to correct
some technical misconceptions.

> Ah, but there is. Maybe that is why you found it hard to
> read. The nice thing about hard tabs is that they are very
> easy for sed and awk to determine where the columns are.

Actually, there is not. [1]  The thing you forgot about here
is that data delimited with tabs is usually displayed with
aligned columns, which is what is desired in this case.  A
tab is not simply represented as a given number of spaces; it
is displayed as a series of spaces up until the next "tab
stop."

This a good application for awk, since it works with columns
of data, but it is still not a one-liner since there are
multiples tables of data in the message.

> : jglover@example.com; sed -i -e 's/\t/    /g' datapr0n.txt  # inside ''

This command results in output that is not aligned.

Cheers,

Travis

[1] Note that it is not possible to use a single (extended)
regular expression to reformat the tables with optimal
spacing for each column, which is the case of the data in
question.  It would be possible, however, if one were to
specify a fixed column width for all columns.  Note that
such a solution would have to be an extended regular
expression (with backreferences) and would not be solvable
using a regular expression or equivalent FSM.



Home | Main Index | Thread Index

Home Page Mailing List Linux and Japan TLUG Members Links