Sponsored Content
Top Forums Shell Programming and Scripting Comparing two files in UNIX and create a new file similar to equi join Post 302924353 by satece on Saturday 8th of November 2014 07:44:24 AM
Old 11-08-2014
Comparing two files in UNIX and create a new file similar to equi join

I have 2 files namely branch.txt file & RXD.txt file as below

Ex:Branch.txt
=========================
Code:
   B1,Branchname1,city,country
   B2,Branchname2,city,country
   B3,Branchname3,city,country
   B4,Branchname4,city,country
   B5,Branchname5,city,country

RXD file : will contain old branch code, old accountid, new branch code and new Accountid.
========

RXD.txt
===============
Code:
   B1,B1A1,WB1,WB1A1
   B1,B1A2,WB1,WB1A2
   B2,B2A1,WB2,WB2A1
   B2,B2A2,WB2,WB2A2
   B3,B3A1,WB3,WB3A1
   B1,B3A2,WB3,WB3A2

We need to compare old branch codes in the abv 2 files and create a new newBranchfilter.txt with new branch code (Similar to oracle equi join)

newBranchfilter.txt
=================
Code:
   WB1,Branchname1,city,country
   WB2,Branchname2,city,country
   WB3,Branchname3,city,country

Im new to Unix shell scripting..can anyone help me to solve this using unix shell script.
Thank you!


Moderator's Comments:
Mod Comment Please use code tags next time for your code and data. Thanks

Last edited by vbe; 11-08-2014 at 08:53 AM..
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

How to join flat files together under unix

Hi, I have 7 big flat files, each contains 24 million records which have been sorted by the first field delimitered by Ctrl B (002). I want to join them together side by side, eg. File A: 1^Ba^Bb 2^Bx^By .... File B: 1^Bc^Bd 2^Bm^Bn .... After merged, it should look like :... (7 Replies)
Discussion started by: xli
7 Replies

2. Shell Programming and Scripting

Find duplicate value comparing 2 files and create an output

I need a perl script which will create an output file after comparing two diff file in a directory path: /export/home/abc/file1 /export/home/abc/file2 File Format: <IP>TAB<DeviceName><TAB>DESCRIPTIONS file1: 10.1.2.1.3<tab>abc123def<tab>xyz.mm1.ppp.... (2 Replies)
Discussion started by: ricky007
2 Replies

3. Shell Programming and Scripting

Comparing similar columns in two different files

Hi, I have two text files.The first and the 2nd file have data in the same format For e.g. The first file has table_name1 column1 sum(column1) max(column1) min(column1) table_name1 column2 sum(column2) max(column2) min(column2) table_name1 coulmn3 sum(column3) max(column3) min(column3) ... (13 Replies)
Discussion started by: ragavhere
13 Replies

4. Shell Programming and Scripting

Help in unix script to join similar lines of input

Hi, I have been thinking of how to script this but i have no clue at all.. Could someone please help me out or give me some idea on this? I would like to group those lines with the same first variable in each line, joining the 2nd variables with commas. Let's say i have the following input. ... (3 Replies)
Discussion started by: rei125
3 Replies

5. Shell Programming and Scripting

Create SQL DML insert statements from file using AWK or similar

Hi all. This is my first post on this forum. I've previously found great help in the huge knowledgebase that is here, but this time I have not been able to find a solution to my problem. I have a large text file that looks like this: typedef struct ABC_struct_nbr1_ { char attr1; /*... (0 Replies)
Discussion started by: Yagi Uda
0 Replies

6. Shell Programming and Scripting

Join all the lines matching similar pattern

I am trying to Join all the lines matching similar pattern. Example ; I wanted to join all the lines which has sam to a single line. In next line, i wanted to have all the lines with jones to a single line....etc > cat sample.txt sam 2012/11/23 sam 2012/12/5 sam 2012/12/5 jones... (2 Replies)
Discussion started by: evrurs
2 Replies

7. Shell Programming and Scripting

Comparing Select Columns from two CSV files in UNIX and create a third file based on comparision

Hi , I want to compare first 3 columns of File A and File B and create a new file File C which will have all rows from File B and will include rows that are present in File A and not in File B based on First 3 column comparison. Thanks in advance for your help. File A A,B,C,45,46... (2 Replies)
Discussion started by: ady_koolz
2 Replies

8. Shell Programming and Scripting

How to join one file with multiple files in a directory in UNIX?

Dear folks Hello I have a one file called (file1) which the structure looks like this 1 gi|358484521|ref|NW_003764373.1| 1 gi|358484520|ref|NW_003764374.1| 1 gi|358484519|ref|NW_003764375.1| . . . 30 gi|368484519|ref|NW_00449375.1| In addition, I have around 300... (19 Replies)
Discussion started by: sajmar
19 Replies

9. Shell Programming and Scripting

Alignment tool to join text files in 2 directories to create a parallel corpus

I have two directories called English and Hindi. Each directory contains the same number of files with the only difference being that in the case of the English Directory the tag is .english and in the Hindi one the tag is .Hindi The file may contain either a single text or more than one text... (7 Replies)
Discussion started by: gimley
7 Replies

10. UNIX for Beginners Questions & Answers

How to compare two files in UNIX using similar to vlookup?

Hi, I want to compare same column in two files, if values match then display the column or display "NA". Ex : File 1 : 123 abc xyz pqr File 2: 122 aab fdf pqr fff qqq rrr (1 Reply)
Discussion started by: hkoshekay
1 Replies
APT-SPY.CONF(5) 						File Formats Manual						   APT-SPY.CONF(5)

NAME
apt-spy.conf - configuration file for apt-spy(8) DESCRIPTION
apt-spy.conf is the configuration file for apt-spy(8). It consists of a series of area labels, followed by a list of countries belonging to that label. Whitespace is ignored. Comments may be added anywhere, and begin with the hash ('#') character. Once a hash character is encountered, the rest of the line is ignored. A label consists of any alphanumeric characters, and ends with a colon character (':'). The label must be on a line by itself (excluding comments). Following a label are a list of country codes (one per line) of countries belonging to that label. Each country has a unique two-letter country code corresponding to its top level domain identifier. This is the same as the ISO3166 code. You can find the country code for a specific country either by looking at /var/lib/apt-spy/mirrors.txt, or by looking at the commented examples in the default apt-spy.conf. Labels cannot exist within labels. The end of a label section is signaled by the start of a new one, or by the end of file. Any valid label existing in apt-spy.conf can be specified to apt-spy using the '-a' option. apt-spy will then proceed to benchmark the mirrors in the list of countries associated with that label. EXAMPLES
This is an example of a valid apt-spy.conf file: USUK: GB # United Kingdom US # United States Australia: AU France-Germany-Netherlands: FR DE NL There is a default configuration file included with apt-spy. For further examples, and for a list of valid country codes, please refer to this. SEE ALSO
apt-spy(8), apt(8), sources.list(5) 20th May, 2003 APT-SPY.CONF(5)
All times are GMT -4. The time now is 11:17 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy