Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

sql with AWK

Status
Not open for further replies.

samtg

Programmer
Joined
Jul 22, 2003
Messages
8
Location
MA
Hi
Is there anyway to use SQL ("select") on a awk program?
thanks.
 
can you be just a little bit more specific,pls?!

thanks

vlad
+----------------------------+
| #include<disclaimer.h> |
+----------------------------+
 
Hi
i have a file and i want to do some controls on it, for example :

file whith a pipe delimiter :

2002|x|125464|000012356984|1000.00|500.00|500.00|
2002|y|0|125489632158|5000.00|1000.00|4000.00|
2002|z|126589|12548|2000.00|500.00|1500.00|
2002|a|256894|000000215698|1000.00|200.00|800.00|
2002|y|125698|000012349658|200.00|10.00|190.00|

i have a table on an informix database that contains n columns such as
2002|x|125464|000012356984|1000.00|500.00|500.00|
2002|y|125698|000012349658|200.00|10.00|190.00|

i want to verify if column1 & column2 & column3 on file, if they exist on a table of my database, for example :
2002 & x & 125464 exist
2002 & y & 125698 exist
2002 & z & 126589 not exist

thanks a lot.
 
Unload your informix table with dbaccess in, say, table.unl
Then try something like this:
Code:
awk -F'|' '
BEGIN{while((getline <&quot;table.unl&quot;)>0)T[$1&quot;,&quot;$2&quot;,&quot;$3]++}
T[$1&quot;,&quot;$2&quot;,&quot;$3]>0{print >&quot;ok.unl&quot;}
{print >&quot;bad.unl&quot;}
' /path/to/file2test.unl

Hope This Help
PH.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top