How do you make a script NON CASE SENSASTIVE 
Author Message
 How do you make a script NON CASE SENSASTIVE

Is there a function to make awk NON CASE SENSASTIVE???

Any help would be appreciated

Cheers,
Ariel
--
++++++++++++++++++++++++++++++++++++++++++++++
Ariel

http://www.{*filter*}us.ca/~sandbear
++++++++++++++++++++++++++++++++++++++++++++++



Mon, 23 Apr 2001 03:00:00 GMT  
 How do you make a script NON CASE SENSASTIVE
In the BEGIN block, set the value of IGNORECASE to non-zero if you want
to initialize your program in non-case sensitive mode. Conversely, if
you need case sensitivity, set it to zero. Within the body of the script
you can change back and forth as you need. Here is the description of
the IGNORECASE variable from the gawk 3.0.3 documentation:

IGNORECASE *
     If IGNORECASE is non-zero or non-null, then all string comparisons,
and all regular expression matching are case-independent. Thus, regexp
     matching with `~' and `!~', and the gensub, gsub, index, match,
split and sub functions, record termination with RS, and field splitting
     with FS all ignore case when doing their particular regexp
operations. The value of IGNORECASE does not affect array subscripting.
See
     section Case-sensitivity in Matching. If gawk is in compatibility
mode (see section Command Line Options), then IGNORECASE has no special
     meaning, and string and regexp operations are always
case-sensitive.

Quote:

> Is there a function to make awk NON CASE SENSASTIVE???

> Any help would be appreciated

> Cheers,
> Ariel
> --
> ++++++++++++++++++++++++++++++++++++++++++++++
> Ariel

> http://www.{*filter*}us.ca/~sandbear
> ++++++++++++++++++++++++++++++++++++++++++++++

Cesar

--
Please remove the uppercase characters from my e-mail address for the
real thing



Wed, 25 Apr 2001 03:00:00 GMT  
 How do you make a script NON CASE SENSASTIVE

Quote:

> X-No-Archive: yes

> Hallo Ariel,

>  > Is there a function to make awk NON CASE SENSASTIVE???

> in general, you can add following rule as the very first one to be
> executed on each line of input, and in all following rules, do string
> comparing, regexps etc. against upper letters only.

> {
>         $0 = toupper($0);
> }

This would have the undesired effect of changing the case in the ouput
as well. It would be better to do the comparison against the toupper()
value than to change the value; i.e.

        match(toupper($0),regexp)

But the easiest way is to use the IGNORECASE=1 (for case-insensitive) or
IGNORECASE=0 (for case-sensitive) if your version of awk supports it.

Quote:
> When using gawk, you could do an IGNORECASE = "yes" in the BEGIN-rule to
> achieve the same effect.

> Bis dann, Thomas

Cesar
--
Please remove the uppercase characters from my e-mail address for the
real thing


Sat, 28 Apr 2001 03:00:00 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. Need Example CICS/REXX doing CICS LINK with COMMAREA to non-REXX PGM

2. tcl 8.2 regexp not doing non-greedy matching correctly

3. Is this safe? (Making string comparisons ignore case)

4. making the Python case to my dept.

5. making the Python case to my dept

6. making a case for Fortran

7. making a case for FORTRAN

8. Making an engineering case for Lisp

9. Upper case / Lower case I'm a lost case

10. Clipper search non-case sensitive

11. CASE vs case vs Case...

12. Case insensitivity and non-English languages

 

 
Powered by phpBB® Forum Software