coreutils
[Top][All Lists]
Advanced

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

Re: Enhancement suggestion for "expand"


From: Assaf Gordon
Subject: Re: Enhancement suggestion for "expand"
Date: Mon, 14 Jan 2013 09:40:02 -0500
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:10.0.4) Gecko/20120510 Icedove/10.0.4

Hello,

Anoop Sharma wrote, On 01/14/2013 04:58 AM:
> On Mon, Jan 14, 2013 at 5:04 AM, Pádraig Brady <address@hidden 
> <mailto:address@hidden>> wrote:
> >    On 09/18/2012 03:18 PM, CoreUtils subscribtion for PLC wrote:
> >
> >        I oten use expand to format scripts output by manually setting tabs 
> > stop. The idea would be to add an option to "expand" to be able to auto-set 
> > tabstops by analyzing first <n> lines of test (0 for analyzing whole 
> > stream) so that the TS would be set to the minimum number of spaces to 
> > obtains clean columns.
> 
> 
> This feature is already provided by a separate utility named column, 
> dedicated to columnization, which is available under BSD license.
> 
> What is not provided there is ability to analyze only first <n> lines. 
> 
> So unless it is about licensing, it may be better to enhance column instead 
> of expand. If licensing is an issue then it may be better to add a utility 
> dedicated to columnization to Coreutils, instead of enhancing expand.
> 

For a possible work-around, I'm using a Perl+shell wrapper scripts that do 
exactly what you're asking for.

'detect_tab_stops' reads a single text file and prints a comma-separated list 
of tab stops, based on the first N lines (default 100).
https://github.com/agordon/bin_scripts/blob/master/scripts/detect_tab_stops.in

'atexpand' uses 'detect_tab_stops' to run 'expand' with auto-tabbing.
https://github.com/agordon/bin_scripts/blob/master/scripts/atexpand.in

'atless' uses 'detect_tab_stops' to run 'less -S -x' with proper auto-tabbing.
https://github.com/agordon/bin_scripts/blob/master/scripts/atless.in


The quickest way to install those is probably by taking the entire package ( 
https://github.com/agordon/bin_scripts ) and running "configure", but they are 
AGPL and you are welcome to take them and modify them.

-gordon




reply via email to

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