Couple of easy questions for experts on awk/sed

Hello Experts..
I have 3-4 C codes with Oracle SQL statements embedded. All the SQL statements starts with EXEC SQL keyword and ends with ; . I want to extract all the SQL statements out of these codes.
I did awk '/^[ ]EXEC SQL/,/\;/' inputFile (I use this on all of the codes individually). That worked fine. I have couple of questions:

  1. How to make searching in awk (non GNU) a case insensitive affair? EXEC SQL or exec sql should both be selected.
  2. All the tables starts with "T_". How can I make all the tables upper case ones? E.g. t_table should become T_TABLE in output.

Thanks in advance !

---------- Post updated at 09:40 AM ---------- Previous update was at 09:28 AM ----------

I guess I got answer to 1st questions:
I can do something like this:
[Ee][Xx][Ee][cC] [sS][qQ][Ll] . :slight_smile:

You could also use awk string functions tolower or toupper:

awk 'tolower($0) ~ /exec sql/' file

OR

awk 'toupper($0) ~ /EXEC SQL/' file

These functions can be used for your 2nd problem as well.

Yoda, that is awesome. Didn't knew that there are such functions in awk :slight_smile:
Thanks