lookup


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting lookup
# 1  
Old 04-01-2009
lookup

I have a lookup file in unix say /data/lkp.dat (First line is header and space delimited) and the content is shown below.
Another file which contains the job_name and rec_count lets say /data/data_file.dat(no header pipe delimited file).
Now i want to do a lookup on job_name and my output should be 4 files
TYPE1_File1
TYPE2_File2
TYPE3_File3
TYPE4_File4

depending on TYPE field.The output should be a | delimited file
and the layout will be

FILE_NAME
REC_COUNT



Code:
JOB_NAME	FILE_NAME	TYPE
A_1	HGG.dat	TYPE1
B_1	SDF.dat	TYPE1
C_1	FHH.dat	TYPE1
D_1	UUU.dat	TYPE1
E_1	UUKK.dat	TYPE1
A_2	HGG.dat	TYPE2
B_2	SDF.dat	TYPE2
C_2	FHH.dat	TYPE2
D_2	UUU.dat	TYPE2
E_2	UUKK.dat	TYPE2
A_3	HGG.dat	TYPE3
B_3	SDF.dat	TYPE3
C_3	FHH.dat	TYPE3
D_3	UUU.dat	TYPE3
E_3	UUKK.dat	TYPE3
A_4	HGG.dat	TYPE4
B_4	SDF.dat	TYPE4
C_4	FHH.dat	TYPE4
D_4	UUU.dat	TYPE4
E_4	UUKK.dat	TYPE4


Last edited by Yogesh Sawant; 04-01-2009 at 02:51 PM.. Reason: added code tags
# 2  
Old 04-01-2009
Every day the file name will contain one extention of system date in YYYYMMDD format like
Code:
HGG_20090401.dat


Last edited by Yogesh Sawant; 04-01-2009 at 02:51 PM.. Reason: added code tags
# 3  
Old 04-01-2009
what have you done so far?
# 4  
Old 04-01-2009
Quote:
Originally Posted by Yogesh Sawant
what have you done so far?
If i can get the code to do a lookup with job_name as key(the data file has no headers and first line of lookup file is a header) rest all things can be done.it would be great if you can help with the lookup code
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Lookup first high value

Hello experts, I have a file looking like v1 g1 5.42 v2 g1 2.43 v1 g2 1.24 v3 g2 0.6 I want to lookup the first value in another sorted table which is greater than column 3 value, keying on column 2 on the first table. The sorted table looks like the following,. where I want to find... (3 Replies)
Discussion started by: sheetalk
3 Replies

2. What is on Your Mind?

Whois Lookup

Hi. I've just made our internal Whois lookup service available for all forum users, not only moderators and admins. Whois Database It's basically the same whois info you can get from your command line and many other web sites. If you would like to see other features, please post in... (0 Replies)
Discussion started by: Neo
0 Replies

3. Shell Programming and Scripting

Lookup file

Hi, need your help to lookup these 2 files main.txt RNPMS01,PMS717W_Marasi,CXP9016141/1_R7G04,EXECUTING RNPMS01,RAP765W_BakaranBatu,CXP9014346/1_R6AG03,EXECUTING RNPMS01,RNPMS01,CXP9014711/2_R5Z,EXECUTING RNPMS01,TBT510W_Bandar_Utama,CXP9014346/1_R6AG03,EXECUTING... (8 Replies)
Discussion started by: singgih
8 Replies

4. Shell Programming and Scripting

Ip Location Lookup

Hello everybody; I am working on a script about ip location lookup. I 've a decimal list dec_list: 16777216,17367039,AU,AUS,AUSTRALIA 17367040,17432575,MY,MYS,MALAYSIA 17432576,17498111,AU,AUS,AUSTRALIA 17498112,17563647,KR,KOR,REPUBLIC OF KOREA 17563648,17825791,CN,CHN,CHINA... (2 Replies)
Discussion started by: mustafayilmaz
2 Replies

5. Shell Programming and Scripting

lookup in a list

I have a list of ids and a master list. I need to display entries from the master list matching ids in the first list. The master list is space delimited, id is 1st field. $ cat id_list 2010 7 51 $ cat master_list 1 one detail1 detail2 2 two detail1 avg1 detail2 avg2 ... etc ... ... (3 Replies)
Discussion started by: migurus
3 Replies

6. UNIX for Advanced & Expert Users

Clueless about how to lookup and reverse lookup IP addresses under a file!!.pls help

Write a quick shell snippet to find all of the IPV4 IP addresses in any and all of the files under /var/lib/output/*, ignoring whatever else may be in those files. Perform a reverse lookup on each, and format the output neatly, like "IP=192.168.0.1, ... (0 Replies)
Discussion started by: choco4202002
0 Replies

7. Shell Programming and Scripting

Lookup file

I have two files ,File1 lookup to file2 based on 1st&3rd against 1st and 2nd column and produce the following o/p File1 450000|USD|USD 450006|GKSGD|SGD 450002|XSGD|SGD File2 ----- 450000|USD|2000.00|10000.000 450006|SGD|1000.200|3000.000 450002|SGD|3000.000|20000.00 O/p ... (4 Replies)
Discussion started by: mohan705
4 Replies

8. UNIX for Dummies Questions & Answers

lookup in unix

i am having one file which is of CSV format with two fields client_id and client_nbr.The sample data is lke below ABC,1250 CDE,1520 EFG,1000 PQR,1800 The client nbr for these clients change frequently.So i want to create one lookup file every week for the changed client and run a script... (3 Replies)
Discussion started by: dr46014
3 Replies

9. Shell Programming and Scripting

Lookup on a file

Hi, I have the following requirement. I have one lookup file which contains 15 columns and 7000 records. Ex: 123,MEDICA,134,145,1178,123,678,345,2345,HP,COL,K12,SR,OX,78919 I have input file which contains 14 columns and 20 million records.Some times the record count is more... (4 Replies)
Discussion started by: ukatru
4 Replies

10. UNIX for Advanced & Expert Users

Lookup on a file

Hi, I have the following requirement. I have one lookup file which contains 15 columns and 7000 records. Ex: 123,MEDICA,134,145,1178,123,678,345,2345,HP,COL,K12,SR,OX,78919 I have input file which contains 14 columns and 20 million records.Some times the record count is more than 20... (1 Reply)
Discussion started by: ukatru
1 Replies
Login or Register to Ask a Question