NAWK - seach pattern for special characters - } dbl qt - sng qt

i'm puzzled....

trying to look for the pattern }"'. but the below code returns to me the message below (pattern is curley queue + dbl qt + sng qt + period)

  
nawk -v pat="\}\"\'\."'
          {
            if (match($0, pat)) {
               before = substr($0,1,RSTART-1);
                 do {
                     pattern = substr($0,RSTART,RLENGTH);
                     printf("%s%s\n", before, pattern);
                     $0=substr($0, RSTART+RLENGTH)
                    } while (match($0, pat))
                 }
          }' $HOME/TEMP/X1.dat >> $HOME/TEMP/X2.dat

a sample data file, please.

I'm sure its not this easy, but is it a direct cut and paste of your code?

  
nawk -v pat="\}\"\'\."'
 It looks like the last single quote is out of place...
nawk -v pat="\}\"\'\."

sample data file:

output to be 2 results

1rst result for "${Gedwschema}"'.plcy_sts
2nd result for '"${Gedwschema}"'.vhcl
[/SIZE]

The output is different though...

nawk -v pat="}\"'\." -f dan1.awk dan1.txt

the single quote you removed at the end of the nawk line (i think ??) encapsulates the whole rest of the expression... no?

 
nawk -v pat="\}\"\'\."'
          {
            if (match($0, pat)) {
               before = substr($0,1,RSTART-1);
                 do {
                     pattern = substr($0,RSTART,RLENGTH);
                     printf("%s%s\n", before, pattern);
                     $0=substr($0, RSTART+RLENGTH)
                    } while (match($0, pat))
                 }
          }' $HOME/TEMP/X1.dat >> $HOME/TEMP/X2.dat

needed a space before the single quote that incapsulates all that comes after the nawk line..... i appologize..

in summary: (to firm up my understanding)

1) the } doesn't need an escape backslash before it, as it's interpreted literally within the double quotes surounding the pattern.

2) there's no need of an escape backslash before the single quote.... if withing the double quotes surrounding the pattern ---- i'll will take note of that.

here's a little bit better regex pat - you can remove the 'before' part in the 'printf' to get what you actually want:

nawk -v pat="'\"[^ ][^ ]*}\"'\.[^ ][^ ]*" -f dan1.awk dan1.txt

just to firm up my understanding...

below pattern means:

Single quote + none or any number of non-spaces before } + } + double quote + single quote + period + none or any number of non-spaces before � + double quotes

correct.

Thanks again for your time and patience.