awk - special character not working

Hi,

I am trying to use forward slash in awk. While running the command through console, its working fine but not working while running it through shell script.

find . -name "*" -ctime -6 | xargs cat | grep -E -v ^fileName\|^\([0-9]\) | awk -v DATE="${CURR_DATE}" -v DATE_LOG="$DATE_SYS" '
        BEGIN {
                FS = ";"
                OFS = ";"
                CONVFMT = "%.9g"
                OFMT = "%.9g"
        }
        {
                clef = "2-PARSING_ERROR;" DATE ";" DATE_LOG ";"
                substr ( $0, 12, 8) ";" substr ( $0, 5, 6 ) ";NS;N/A;" $3
                tab[clef]++
        }
        END {
                for (clef in tab)
                {
                        print tab[clef],clef
                }
        }
'

Is the problem because my console shell is bash and through script it is ksh?

How to use the forward slash in awk? I tried escaping it with 2 backslashes , also quoting it but none worked.

Please help.

I am not sure if I understand your problem. Which forward slash do you mean? This one in here?

";NS;N/A;"

This works when being used as part of the key in that array (at least with GNU awk).
Only thing I see missing is a backslash to fuse these two lines together:

                clef = "2-PARSING_ERROR;" DATE ";" DATE_LOG ";" \
                substr ( $0, 12, 8) ";" substr ( $0, 5, 6 ) ";NS;N/A;" $3

yes this forward slash : ";NS;N/A;"

but just to show the indentation , i have split the lines like that.

But it is not working because of "N/A". how to handle this slash?

As said with GNU awk it is working. What is your version of awk? What is "not working"? What is the error output you get?
Simplified example:

$ cat infile
one
two
three
$ awk '{_[$1"/"]=$1} END{for(a in _){print "Key:", a, "Value:", _[a]}}' infile
Key: three/ Value: three
Key: two/ Value: two
Key: one/ Value: one

Update:
It even works with the more limited awk on AIX.

I suggest you give us some clue about input and desired output.