Append data by looking up 2 tables for multiple files
I want to lookup values from two different tables based on common columns and append. The trick is the column to be looked up is not fixed and varies , so it has to be detected from the header. How can I achieve this at once, for multiple data files, but lookup tables fixed.
The two lookup tables are ftable and ttable. For ftable I want cols 2 and 3 by matching 1.
For ttable, I want just col 2 based on col1.
ftable
ttable
in the input files , we must detect the column with header rid , that matches with ftable and the column header tid which matches with ttable
1st file from Loc B
2nd File from expA
Desired outputs
1st file from Loc B
Hmmm... this is a bit confusing to parse this explanation.
Could you try it one more time with just ONE example and a desired output, pls.
I'm failing to see what keys you're using to find a match between 2 files...
The keys are rid with ttable (tin or col1) , and fid with ftable (fin or col1) ...the issue is we have to detect which columns rid and tid are in the data since, the column numbers are not fixed in the data.
The keys in the lookup tables are always in column 1.
Another example,
ttable (with key in col 1)
ftable (with key in col 1)
Input data with key fields rid and fid as col2 and col3 respectively. However in another input rid and fid can be in colx and coly. But they will still be called rid and tid.
So when we read the header line of the input file, we can tell which column is rid and which column is tid.
It is difficult to match column names "fid" with "fin" and almost impossible to match "rid" with "tin". So I discontinued that.
Given the column names match (fid=fid, rid=rid), try
this is still confusing....
Looks like you're using 4 diff names: tin/fin for the first 2 tables AND rid/fid for the last table.
I must be thick-skulled today, but I don't get it.
Sorry, maybe somebody else could help you.
Hello All,
just wanted to export multiple tables from oracle sql using unix shell script to csv file and the below code is exporting only the first table.
Can you please suggest why? or any better idea?
export FILE="/abc/autom/file/geo_JOB.csv"
Export= `sqlplus -s dev01/password@dEV3... (16 Replies)
Experts,
I am writing a script and able to write only small piece of code and not able to collect logic to complete this task.
In input file have to look for name like like this (BGL_HSR_901_1AG_A_CR9KTR10) before sh iss neors. Record this (BGL_HSR_901_1AG_A_CR9KTR10) in csv file
Now have to... (0 Replies)
HI
I have a dsv file that looks like:
<<BOF>>
record_number|id_number|first name|last name|msisdn|network|points|card number|gender
312|9101011234011|Test Junior|Smith|071 123 4321|MTN|73|1241551413214444|M
313|9012023213011|Bob|Smith|27743334321|Vodacom|3|1231233232323244|M... (4 Replies)
multiple files to load into different tables,
I have a script show below, but this script loads data from txt file into a table,
but i have multiple input files(xyzload.txt,xyz1load.txt,xyz2load.txt......) in the unix folder ,
can we load these files in diff tables (table 1, table2... (1 Reply)
multiple files to load into different tables,
I have a script show below, but this script loads data from txt file into a table,
but i have multiple input files(xyzload.txt,xyz1load.txt,xyz2load.txt......) in the unix folder ,
can we load these files in diff tables (table 1, table2... (0 Replies)
Hi..Can anyone suggest a simple way of achieving this. I have several files which ends with extension .vcf . I will give example with two files
In the below files, we are interested in
File 1:
38 107 C 3 T 6 C/T
38 241 C 4 T 5 C/T
38 247 T 4 C 5 T/C
38 259 T 3 C 6 T/C... (8 Replies)
Hi,
I'd like to process multiple files. For example:
file1.txt
file2.txt
file3.txt
Each file contains several lines of data. I want to extract a piece of data and output it to a new file.
file1.txt ----> newfile1.txt
file2.txt ----> newfile2.txt
file3.txt ----> newfile3.txt
Here is... (3 Replies)
Hi
I am having a question where I have to
1) Identify the number of files in a directory with a specific format
and if the count is >1 we need to concatenate those two files into one file and remember that in the second file the header should not be copied. it should be form first file.... (4 Replies)
Hi ,
I want to read the data from 9 tables in oracle DB into 9 different files in the same connection instance (session). I am able to get data from one table to one file with below code :
X=`sqlplus -s user/pwd@DB <<eof
select col1 from table1;
EXIT;
eof`
echo $X>myfile
Can anyone... (2 Replies)
I am trying to transpose tables listed in the format into format. Any help would be greatly appreciated.
Input:
test_data_1
1 2 90%
4 3 91%
5 4 90%
6 5 90%
9 6 90%
test_data_2
3 5 92%
5 4 92%
7 3 93%
9 2 92%
1 1 92%
...
Output:... (7 Replies)