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

Fred James fredjame at fredjame.cnc.net
Wed Dec 24 10:27:10 CST 2008


Robert Citek wrote:
> Do they give the same results?
>
> $ whatis  -r . | sort | uniq | wc -l
> 4728
>
> $ man -k . | sort | uniq | wc -l
> 4728
>
> $ for i in $(echo $PATH | cut -d: -f1- --output-delimiter=" "); do
>   for j in $(ls -1 $i) ; do
>     apropos $j
>   done
> done | sort | uniq | wc -l
> apropos: fatal: regex `[': Invalid regular expression
> 4688
>
>
> On Wed, Dec 24, 2008 at 8:59 AM, terry <trryhend at gmail.com> wrote:
>   
>> How about?:
>>
>> man -k .
>>     
All
Do some implementations differ?
Regards
Fred James

# whatis  -r . | sort | uniq | wc -l
1
# whatis . | sort | uniq | wc -l
23
# whatis -r .
whatis: -r: unknown option
# whatis -r
whatis: -r: unknown option
# whatis
usage: whatis keyword ...
# whatis .
B                    (3pm)  - The Perl Compiler
B::Asmdata           (3pm)  - Autogenerated data about Perl ops, used to 
generate bytecode
B::Assembler         (3pm)  - Assemble Perl bytecode
B::Bblock            (3pm)  - Walk basic blocks
B::Bytecode          (3pm)  - Perl compiler's bytecode backend
B::C                 (3pm)  - Perl compiler's C backend
B::CC                (3pm)  - Perl compiler's optimized C translation 
backend
B::Concise           (3pm)  - Walk Perl syntax tree, printing concise 
info about ops
B::Debug             (3pm)  - Walk Perl syntax tree, printing debug info 
about ops
B::Deparse           (3pm)  - Perl compiler backend to produce perl code
B::Disassembler      (3pm)  - Disassemble Perl bytecode
B::Lint              (3pm)  - Perl lint
B::Showlex           (3pm)  - Show lexical variables used in functions 
or files
B::Stackobj          (3pm)  - Helper module for CC backend
B::Stash             (3pm)  - show what stashes are loaded
B::Terse             (3pm)  - Walk Perl syntax tree, printing terse info 
about ops
[ [builtins]         (1)  - bash built-in commands, see bash(1)
: [builtins]         (1)  - bash built-in commands, see bash(1)
B::Xref              (3pm)  - Generates cross reference reports for Perl 
programs
c++filt              (1)  - Demangle C++ and Java symbols
C operator [operator] (7)  - C operator precedence and order of evaluation
O                    (3pm)  - Generic interface to Perl Compiler backends
w                    (1)  - Show who is logged on and what they are doing
#
# uname -a
Linux localhost 2.6.22.19-desktop-2mdv #1 SMP Mon May 5 20:55:05 EDT 
2008 i686 Intel(R) Pentium(R) 4 CPU 1.70GHz GNU/Linux
#




More information about the Discuss mailing list