I have an excel file and I am unable to read it directly into awk (contains , " etc); So, I cleansed and copied the data into notepad.
I need to generate a script that generates the SQL.
Requirement:
1. Filter and select only the data that has the "mapping" as "direct"
2. Add COALESCE and NVL (with sample value of 11111) for all columns according to datatype. I will change it appropriately wherever applicable
3. Whenever the source and target table names are same the queries need to be concatenated with "," so that I validate all relative columns at one pass for each combination of source and target.
4. I will add the required join conditions based on the source and target table names manually;
From the intended output, t1c4 column query is separated as the source table is different; t2c2 is separated as the target table is different;
Input File:
Intended Output:
What I have done:
Excuse any syntax issues as I was not able to copy/paste the code;
My output doesn't seem to concatenate when there are 2 or more than eligible records for the same source and target table name; It has only one target_column no matter how many eligible records are there; For eg: the first source and target table names gives this result
My output through code:
I am not able to figure it out as I am learning awk recently through the forums posts. Also, I am not able to have single quote (') as part of the query directly using ' (tried with backslash,'',''','''') still not working; after searching, used \47 and it breaks when used with numeric chars as \47777777\47
Can you please tell me how to have ' with out using awk variables at the command line or BEGIN and with using awk variables;
Many thanks for your time..
Hmmm - feeling a bit lost here. Nevertheless, some hints:
- for the single quote, either use \047 or terminate the string and immediately reopen it: "...\47" "777707\47"
- as the input consistently seems to be upper case, you might be able to drop the to_lower(...) and to_upper(...) conversions.
- it would concatenate if it got there, but it can't as the respective branch is chosen max once. There IS just nothing to concatenate.
Hi,
I have a file pk.txt which has table related data in following format
TableName | PK
Employee | id
Contact|name,phone,country
I have another file desc.txt which lists datatype of each field like this:
Table|Field|Type
Employee|id|int
Contact|name|string
Contact|country|string... (7 Replies)
Hi,
I have a file containing many records delimited by pipe (|).
Each record should contain 17 columnns/fields. there are some fields having fields less than 17.So i am extracting those records to a file using the below command
awk 'BEGIN {FS="|"} NF !=17 {print}' feedfile.txt... (8 Replies)
Hello
I want to achieve the following.
However the concatenation is not working
mv `ls -ltr *myfile*.log|awk '{print $9}'` `ls -ltr *myfile*.log|awk '{print `date +'%d%m%y%k%M%S'` $9}'`
I tried
awk '{x=`date +'%d%m%y%k%M%S'` print $x "" $9}'
awk '{x=`date +'%d%m%y%k%M%S'`... (2 Replies)
Hello,
I have a table as shown below. I want to concatenate values in col2 and col3 based on a value in col4.
1 X Y A
3 Y Z B
4 A W B
5 T W A
If col4 is A, then I want to concatenate col3 with itself. Otherwise it should concateneate col2 with col3.
1 X Y YY
3 Y Z YZ... (10 Replies)
Hi - I have a word GTTCAGAGTTCTACAGTCCGACGAT
I need to extract all the possible "chunks" of 7 or above letter "words" from this.
SO, my out put should be
GTTCAGA
TTCAGAG
TCAGAGT
CAGAGTTCT
TCCGACGAT
CAGTCCGACG
etc.
How can I do that with awk or any other language? I have no... (2 Replies)
Hi,
I'm not an expert in awk but i need a simple script to do this:
I'd like to AutoCrop PDF files.
I found 2 simple script that combined together could help me to automatize :)
The first utiliti is "pdfinfo" that it gives the MediaBox and TrimBox values from the pdf.
The pdfinfo output... (8 Replies)
Hello All,
I'm tryying to concatenate string and variables value in ksh, but i'm unable to do it, can someone please help in rectifying my error,
here is the code i have written,
#!/usr/bin/ksh -x
cat $1 | while read fileline
do
val1= echo $fileline | awk -F, '{print $1}'
val2= echo... (3 Replies)
Hello friends,
I have a problem in printing an array..
Example if my array line contains 4 elements like following
line=0002 , line=202200, line=200002, line= 300313
Now one = sprintf line line line line will concatenate my whole array to one.
But I am not sure about the... (7 Replies)
Hi all,
I have a doubt in SQL Loader.
We have SEQUENCE function in SQL Loader or can create Sequence in Oracle database for generating a number sequence for
a column while loading data using SQL Loader into table or multiple tables.
My requirment is this.
For the first run in SQL... (2 Replies)