The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
Google UNIX.COM


Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
case insensitive on purpose file system 0.1 (Default branch) iBot Software Releases - RSS News 0 05-10-2008 03:40 PM
case insensitive ROOZ Shell Programming and Scripting 4 03-11-2008 09:40 AM
how to make case insensitive checks???? hitmansilentass Shell Programming and Scripting 5 04-30-2007 11:23 AM
Case-insensitive serach with awk acheepi Shell Programming and Scripting 4 07-15-2005 02:58 PM
case insensitive locate davis.ml UNIX for Dummies Questions & Answers 3 11-17-2003 08:14 PM

Reply
 
Submit Tools LinkBack Thread Tools Search this Thread Display Modes
  #1  
Old 09-13-2006
Registered User
 

Join Date: Sep 2006
Posts: 23
awk case-insensitive

can I tell awk to be case insensitive for one operation without setting the ignorecase value ?

thanks,
Steffen
Reply With Quote
Forum Sponsor
  #2  
Old 09-13-2006
Registered User
 

Join Date: Mar 2006
Location: Bangalore,India
Posts: 1,397
You cannot use IGNORECASE to make certain rules case-insensitive and other rules case-sensitive, because there is no way to set IGNORECASE just for the pattern of a particular rule.
To do this, you must use character sets or tolower.
However, one thing you can do only with IGNORECASE is turn
case-sensitivity on or off dynamically for all the rules at once.
Reply With Quote
  #3  
Old 09-13-2006
Registered User
 

Join Date: Sep 2006
Posts: 23
I know I cannot use IGNORECASE for only certain commands, only globally.

I didnt want to IGNORECASE anyway. My problem is that I have to look for a match in a file using awk and the search string is a variable. Since I cannot control if the variable is lower or upper case, I need to have awk search for any lower or uppercase match(es).

Steffen
Reply With Quote
  #4  
Old 09-13-2006
Registered User
 

Join Date: Mar 2006
Location: Bangalore,India
Posts: 1,397
if you are searching for word "goat" use this
/[Gg][Oo][Aa][Tt]/
Reply With Quote
  #5  
Old 09-13-2006
Registered User
 

Join Date: Sep 2006
Posts: 23
I know that, but I have a user input variable as the search string, I cannot alter the variable to [Aa][Bb][Cc].....

Steffen
Reply With Quote
  #6  
Old 09-13-2006
Playing with Ubuntu Now!
 

Join Date: Oct 2005
Location: Chennai
Posts: 364
tolower/toupper

Why not use the functions tolower()/toupper() functions in awk. That might help you.
Reply With Quote
  #7  
Old 09-13-2006
Registered User
 

Join Date: Sep 2006
Posts: 23
I don't know this function, will take a look at it

thanks,
Steffen
Reply With Quote
Google The UNIX and Linux Forums
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes




All times are GMT -7. The time now is 11:19 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited.
The UNIX and Linux Forums Content Copyright ©1993-2008. All Rights Reserved.Ad Management by RedTyger Visit The Complex Event Processing Blog

Content Relevant URLs by vBSEO 3.2.0