Sponsored Content
Full Discussion: lookup
Top Forums Shell Programming and Scripting lookup Post 302302926 by dr46014 on Wednesday 1st of April 2009 11:09:34 AM
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
 

10 More Discussions You Might Find Interesting

1. 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

2. 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

3. 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

4. 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

5. 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

6. 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

7. 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

8. 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

9. 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

10. 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
SOCKETMAP_TABLE(5)						File Formats Manual						SOCKETMAP_TABLE(5)

NAME
socketmap_table - Postfix socketmap table lookup client SYNOPSIS
postmap -q "string" socketmap:inet:host:port:name postmap -q "string" socketmap:unix:pathname:name postmap -q - socketmap:inet:host:port:name <inputfile postmap -q - socketmap:unix:pathname:name <inputfile DESCRIPTION
The Postfix mail system uses optional tables for address rewriting. mail routing or policy lookup. The Postfix socketmap client expects TCP endpoint names of the form inet:host:port:name, or UNIX-domain endpoints of the form unix:path- name:name. In both cases, name specifies the name field in a socketmap client request (see "REQUEST FORMAT" below). PROTOCOL
Socketmaps use a simple protocol: the client sends one request, and the server sends one reply. Each request and each reply are sent as one netstring object. REQUEST FORMAT
The socketmap protocol supports only the lookup request. The request has the following form: name <space> key Search the named socketmap for the specified key. Postfix will not generate partial search keys such as domain names without one or more subdomains, network addresses without one or more least-significant octets, or email addresses without the localpart, address extension or domain portion. This behavior is also found with cidr:, pcre:, and regexp: tables. REPLY FORMAT
The Postfix socketmap client requires that replies are not longer than 100000 characters (not including the netstring encapsulation). Replies must have the following form: OK <space> data The requested data was found. NOTFOUND <space> The requested data was not found. TEMP <space> reason TIMEOUT <space> reason PERM <space> reason The request failed. The reason, if non-empty, is descriptive text. SECURITY
This map cannot be used for security-sensitive information, because neither the connection nor the server are authenticated. SEE ALSO
http://cr.yp.to/proto/netstrings.txt, netstring definition postconf(1), Postfix supported lookup tables postmap(1), Postfix lookup table manager regexp_table(5), format of regular expression tables pcre_table(5), format of PCRE tables cidr_table(5), format of CIDR tables README FILES
Use "postconf readme_directory" or "postconf html_directory" to locate this information. DATABASE_README, Postfix lookup table overview BUGS
The protocol limits are not yet configurable. LICENSE
The Secure Mailer license must be distributed with this software. HISTORY
Socketmap support was introduced with Postfix version 2.10. AUTHOR(S) Wietse Venema IBM T.J. Watson Research P.O. Box 704 Yorktown Heights, NY 10598, USA Wietse Venema Google, Inc. 111 8th Avenue New York, NY 10011, USA SOCKETMAP_TABLE(5)
All times are GMT -4. The time now is 05:15 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy