|
Neohapsis is currently accepting applications for employment. For more information, please visit our website www.neohapsis.com or email hr@neohapsis.com |
From: Clint Pachl (pachl
ecentryx.com)
Date: Sun Aug 05 2007 - 13:19:25 CDT
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Andris wrote:
> On 8/5/07, Jacek Masiulaniec <jacekm
dobremiasto.net> wrote:
>
>> On 4 Aug 2007, at 19:31, Andris wrote:
>>
>>> Hi, I'm writing a set of small utilities as scripts, and I got a
>>> segmentation fault working on one of them.
>>>
>>> The script is suppoused to align text with spaces. Say you have
>>> this file:
>>>
>>> Foo1\tFoo2
>>> Baaaaaaaaaaaar\tBar2
>>> Baz
>>>
>>> Where \t are horizontal tabs. My script would replace the tabs with an
>>> adequate number of spaces to align foo2 and bar2.
>>>
>> Writing replacement for "column -t", huh?
>>
>> Jacek
>>
>
> Didn't know about it :P But I'll do it anyway, cause I want it to be a
> standard and portable script.
>
I believe column(1), including the -t option, is very standard. It has
been around for over 20 years and is included in all the BSDs. I believe
it is also in many of the major Linux distros too.
Don't reinvent the wheel arbitrarily.
See also: sed(1), awk(1), expand(1), colrm(1), paste(1), cut(1),
printf(1), and shell's set command
That should take care of most of your text processing needs.
-pachl
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]