SQL Select and awk

Dear All ,
I have file1.txt contain values like the following:
----------

23
24
25

and I have shell script which has the following :

more file1.txt | awk '{print "select 'DUMP',CODE1||'|'||CODE2||'|'||CODE3 from CODE where CODE1='" $1 "';"}' > file2.sql

all I need is to have the following sql in the file2.sql
select 'DUMP',CODE1||'|'||CODE2||'|'||CODE3 from CODE where CODE1='23';
select 'DUMP',CODE1||'|'||CODE2||'|'||CODE3 from CODE where CODE1='24';
select 'DUMP',CODE1||'|'||CODE2||'|'||CODE3 from CODE where CODE1='25';

but I got error on the | and the DUMP string is look like 'DUMP' is look like DUMP with out single quotations

Please Advise , I believe that the problem in the ' and the | maybe it's a speacial charchters .

Best Regards.

Escape the '|' with a backslash and use for the single quote the octal value \047. The use of the more or cat command with awk is redundant, try this:

awk '{print "select \047DUMP\047,CODE1\|\|\047\|\047\|\|CODE2\|\|\047\|\047\|\|CODE3 from CODE where CODE1=\047" $1 "\047;"}' file1.txt > file2.sql

Thank you very much my friend it's work ,

could you please adivces me where i can find refrences for this things.

Read some stuff about shell quoting. Here's a link to the GNU awk manual regarding quoting with awk:

Quoting - The GNU Awk User's Guide

Regards

Hi Frank,

    shall i know meaning 047 what you have used in between the print command.

You can find the codes in an ascii table:

Ascii Table - ASCII character codes and html, octal, hex and decimal chart conversion

Hope this helps.

Thanks Frank:)