Hello, Anoop Sharma wrote, On 01/14/2013 04:58 AM: > On Mon, Jan 14, 2013 at 5:04 AM, Pádraig Brady <[email protected] > <mailto:[email protected]>> 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
