bug-coreutils
[Top][All Lists]
Advanced

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

Re: wc support for different tab widths


From: Pádraig Brady
Subject: Re: wc support for different tab widths
Date: Thu, 4 Jun 2009 09:32:33 +0100
User-agent: Thunderbird 2.0.0.6 (X11/20071008)

Bob Proulx wrote:
> Hello Sebastian,
> 
> Sebastian Bozlee wrote:
>> I'm sorry if this is the wrong place to post this.
> 
> This is the right place for discussion about 'wc' and development for
> it.  Along with any of the other coreutils.
> 
>> This is my first contribution to an open source project, so feedback
>> is appreciated. I don't expect it to be put in the official code.
> 
> Welcome!
> 
>> I've added the ability to count tabs as any number of spaces over 0 to
>> wc. It's used like this:
>> wc -L --tab-width=4 [files...]
> 
> The threshold for adding single letter options is pretty high.  To do
> that would need pretty strong reasons.  So it would be unlikely that
> a -L option would get added.  Long options are available however.

Bob, -L exists and basically selects the "count screen width" functionality,
so only --tab-width was added with the patch.

> The big problem with the feature you are adding is that it already
> exists in the 'expand' program.  Therefore it isn't needed in 'wc'.
> If you haven't looked at it please look at the 'expand' program.
> 
>   expand -t8 SOMEFILE | wc
> 
> The Unix philosophy is that small programs are built in such a way
> that they can be combined together and create by the combination more
> powerful programs.  The 'expand' program knows all about expanding
> tabs.  The 'wc' program knows all about counts.  Combined they know
> all about counting files with tabs.

This is one of those 50:50 things.
The more general way to do it as Bob suggests is:

  expand -t4 FILE | wc -L

That also has the advantage of allowing one specify arbitrary tab positions.
So I don't think this functionality should be part of wc.

> I am hoping this doesn't discourage you.  In particular it is very
> unusual to actually receive code patches along with suggestions.  That
> was great!

here here.

cheers,
Pádraig.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]