Chu Li wrote:
[CC:'ing ksh93-integration-discuss at opensolaris.org since the question
sometimes comes up on the Solaris side, too]
>   Could anyone give me some examples?

For example this test...
-- snip --
for str in "foo bar" "bar foo" "bar" "chicken foo" "BaR FoO" ;
do
    printf "# String %q\tmatches: " "$str"
    [[ "${str}" == ~(El)foo     ]] && printf "~(El)foo\t"
    [[ "${str}" == ~(Er)foo     ]] && printf "~(Er)foo\t"
    [[ "${str}" == ~(El)bar     ]] && printf "~(El)bar\t"
    [[ "${str}" == ~(El)bar     ]] && printf "~(Er)bar\t"
    [[ "${str}" == ~(Elr)bar    ]] && printf "~(Elr)bar\t"
    [[ "${str}" == ~(Eli)bar    ]] && printf "~(Eli)bar\t"
    [[ "${str}" == ~(Eli)bar    ]] && printf "~(Eli)bar\t"
    [[ "${str}" == ~(F)foo\ bar ]] && printf "~(F)foo\ bar\t"
    [[ "${str}" == ~(Fi)Chicken ]] && printf "~(Fi)Chicken\t"
    [[ "${str}" == ~(Si)Foo*Bar ]] && printf "~(Si)Foo*Bar\t"
    printf "\n"
done
exit 0
-- snip --
... would print:
-- snip --
# String 'foo bar'      matches: ~(El)foo       ~(F)foo bar    
~(Si)Foo*Bar    
# String 'bar foo'      matches: ~(Er)foo       ~(El)bar       
~(Er)bar        ~(Eli)bar       ~(Eli)bar       
# String bar    matches: ~(El)bar       ~(Er)bar        ~(Elr)bar      
~(Eli)bar       ~(Eli)bar       
# String 'chicken foo'  matches: ~(Er)foo       ~(Fi)Chicken    
# String 'BaR FoO'      matches: ~(Eli)bar      ~(Eli)bar
-- snip --

>   How to use the added options "E,F,G,K,N,l,r"?

* Pattern matching systems (all uppercase characters, must come first):
"E" means "egrep" pattern
"F" means "fgrep" pattern
"G" means "grep" pattern
"S" means "shell" pattern
"K" means "korn shell" pattern
"P" means "perl" pattern

* Options (all lowercase characters):
"i" means "case insensitive match"
"l" means "left anchor"
"r" means "right anchor"

>   And what the meaning of "anchor" in manpage?

"left anchor" means that the pattern search starts at the left side
(this is the same as the '^' character in "egrep") and "right anchor"
means the pattern search ends at the right side (this is the same as the
'$' character in "egrep").

----

Bye,
Roland

-- 
  __ .  . __
 (o.\ \/ /.o) roland.mainz at nrubsig.org
  \__\/\/__/  MPEG specialist, C&&JAVA&&Sun&&Unix programmer
  /O /==\ O\  TEL +49 641 3992797
 (;O/ \/ \O;)

Reply via email to