[NTLUG:Discuss] Strings in BASH, an easier way?

David Stanaway david at stanaway.net
Wed Dec 24 01:46:15 CST 2008


Or ...

whatis -s 1 -s 8 -r . | more



David Stanaway wrote:
> Why mess around?
>
> whatis -r .
>
>
>
>
> Robert Citek wrote:
>> On Wed, Dec 24, 2008 at 12:19 AM, Leroy Tennison
>> <leroy_tennison at prodigy.net> wrote:
>>  
>>> for i in `echo $PATH | cut -d: -f1-30 --output-delimiter=" "`; do
>>> for j in `ls -1 $i`; do apropos $j; read; done;
>>> done
>>>
>>> Not only is this a little more verbose than I want but the -f parameter
>>> is a little "brittle" in that there doesn't appear to be any to say
>>> "however many fields there are".
>>>     
>>
>> Just leave off the last number:
>>
>> echo $PATH | cut -d: -f1- --output-delimiter=" "
>>
>> IHMO, once you're getting into moderately sophisticated data
>> structures (e.g. arrays), you're better off with a scripting language
>> like awk.
>>
>> Regards,
>> - Robert
>>
>> _______________________________________________
>> http://www.ntlug.org/mailman/listinfo/discuss
>>
>>   
>
>




More information about the Discuss mailing list