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

terry trryhend at gmail.com
Wed Dec 24 08:59:24 CST 2008


How about?:

man -k .


On Wed, Dec 24, 2008 at 1:50 AM, Leroy Tennison
<leroy_tennison at prodigy.net> wrote:
> 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
>>>
>>>
>>
>>
>> _______________________________________________
>> http://www.ntlug.org/mailman/listinfo/discuss
>>
> WOW, for the specific example this is the best solution yet.
>
> _______________________________________________
> http://www.ntlug.org/mailman/listinfo/discuss
>



-- 
<><



More information about the Discuss mailing list