How to compare 2 field from 2 separated file

 
Thread Tools Search this Thread
Special Forums UNIX and Linux Applications How to compare 2 field from 2 separated file
# 1  
Old 09-19-2011
How to compare 2 field from 2 separated file

I have a problem here. I'm trying to compare multiple fields. Files are like this:

File 1:

Email,Account Number,Contact,Status,Date

File 2:

Name|Address|Contact|Email|Account Number|0000000


Code:
#!/bin/bash

myFolder=`pwd`
TEMPFILE=$myFolder/tempfile

APFILE=$myFolder/file 1.csv
APID=$myFolder/file 1.src

AAPFILE=`ls $myFolder/$1`
AAPID=$myFolder/file 2.src
AAPID2=$myFolder/file 2.src

AAPXAP=$myFolder/Result.csv

if [ -f $APFILE -a -f $AAPFILE ]
then
 cat $APFILE | cut -f1 -d, | sed 's/ //g' | sort | uniq > $APID
 cat $AAPFILE | cut  -f37 -d"|" | sort | uniq > $AAPID
 comm -23 $AAPID $APID > $AAPXAP

 echo "AAP vs AP done!"
fi


Thank You

Last edited by pludi; 09-19-2011 at 03:57 AM..
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

File Compare at field level

Hi, I am trying to compare two fixed width files as shown below. The file is NOT sorted. The field in bold red is the key field. The comparison needs to be based of key fields and not whole record. But needs to write out the whole record in the output. OldFile.txt: A100135123456789 ... (5 Replies)
Discussion started by: Saanvi1
5 Replies

2. UNIX for Dummies Questions & Answers

Help with AWK - Compare a field in a file to lookup file and substitute if only a match

I have the below 2 files: 1) Third field from file1.txt should be compared to the first field of lookup.txt. 2) If match found then third field, file1.txt should be substituted with the second field from lookup.txt. 3)Else just print the line from file1.txt. File1.txt:... (4 Replies)
Discussion started by: venalla_shine
4 Replies

3. Shell Programming and Scripting

Plz Help. Compare 2 files field by field and get the output in another file.

Hi Freinds, I have 2 files . one is source.txt and second one is target.txt. I want to keep source.txt as baseline and compare target.txt. please find the data in 2 files and Expected output. Source.txt 1|HYD|NAG|TRA|34.5|1234 2|CHE|ESW|DES|36.5|134 3|BAN|MEH|TRA|33.5|234... (5 Replies)
Discussion started by: i150371485
5 Replies

4. Shell Programming and Scripting

Compare two files Field by field and output the result in another file

Hi Friends, Need Help. I have file1.txt as File1.txt |123|A|7267|Hyder|Cross|Sell|7801 |995|A|7051|2008|Lunar|New|Year|Promotion|7801 |996|A|7022|Q108|Targ|Prospect|&|SSCC|Savings|Promo|7801 |997|A|7182|Q1|Feb-Apr|08|Credit|ITA|PA|SBA|Campaign|7801 File2.txt... (7 Replies)
Discussion started by: i150371485
7 Replies

5. Shell Programming and Scripting

Text file to CSV with field data separated by blank lines

Hello, I have some data in a text file where fields are separated by blank lines. There are only 6 fields however some fields have several lines of data as I will explain. Also data in a particular field is not consistently the same size but does end on a blank line. The first field start with... (6 Replies)
Discussion started by: vestport
6 Replies

6. Shell Programming and Scripting

Inserting string in between field in comma separated file

Hello Mates, I have one txt file having commo seperated values. I have to insert string "FALSE" in 2nd field from the end. E.G SE18 6RN,,,,5439070,1786840,,1000002148671600,123434 Out put should be: SE18 6RN,,,,5439070,1786840,FALSE,1000002148671600,123434 Can some one help me to... (8 Replies)
Discussion started by: krsnadasa
8 Replies

7. Shell Programming and Scripting

AWK: Pattern match between 2 files, then compare a field in file1 as > or < field in file2

First, thanks for the help in previous posts... couldn't have gotten where I am now without it! So here is what I have, I use AWK to match $1 and $2 as 1 string in file1 to $1 and $2 as 1 string in file2. Now I'm wondering if I can extend this AWK command to incorporate the following: If $1... (4 Replies)
Discussion started by: right_coaster
4 Replies

8. Shell Programming and Scripting

Compare Tab Separated Field with AWK to all and print lines of unique fields.

Hi. I have a tab separated file that has a couple nearly identical lines. When doing: sort file | uniq > file.new It passes through the nearly identical lines because, well, they still are unique. a) I want to look only at field x for uniqueness and if the content in field x is the... (1 Reply)
Discussion started by: rocket_dog
1 Replies

9. Shell Programming and Scripting

Compare two columns separated by a tab

witam potrzebuje polecenia porownujacego koumny na podstawie n-ostatnich znakow danej linnijki tj mam 2 koumny AiB zawierajace ciag dowolnych znakow (dlugosci w kazdej linijce mga byc rozne wiec uzycie substra odpada) A B ewewewabc nbgujnnabc... (3 Replies)
Discussion started by: Toudi
3 Replies

10. Shell Programming and Scripting

How to format file into comma separated field

Guys, Need you help, i have a a file content that look like this. Nokia 3330 <spaces><spaces><more spaces>+76451883874 Nokia 3610 +87467361615 so on and so forth, - there are so many spaces in between. - e.g.... (5 Replies)
Discussion started by: shtobias
5 Replies
Login or Register to Ask a Question
dxaccounts(8)						      System Manager's Manual						     dxaccounts(8)

NAME
dxaccounts - Graphical interface for account administration SYNOPSIS
/usr/bin/X11/dxaccounts DESCRIPTION
The Account Manager application, dxaccounts, helps you manage user accounts on your Tru64 UNIX system. It operates on both base security level systems and enhanced security (C2) level systems. The Account Manager application lets you manage both the local and Network Information Service (NIS) UNIX account databases. NIS is used in order to centrally manage user accounts in a network environment. NIS lets participating systems share a common set of passwd and group files. NIS uses a client-server model. When the Advanced Server for Tru64 UNIX product is installed, the Account Manager application allows you to perform domain user account management for PC users. To start Account Manager from the CDE desktop:Choose the Application Manager from the CDE front panel. Choose the System_Admin group. Choose the DailyAdmin group. Click on the Account Manager icon. Online help is available for the dxaccounts application. To get help, click on any Help button or use the Help pull-down menu. Account Manager replaces the XSysAdmin(8) and XIsso(8) applications. RESTRICTIONS
You must have root privileges to modify system files with this application. If dxaccounts is run without root permission, you may view but not modify account information. In order to make changes to the NIS databases, you must run Account Manager on the machine designated as the NIS server. FILES
Defaults that are shared by the graphical user and command-line interfaces System and account defaults (enhanced security only) Group information for local groups Account information for local user accounts List of shells on the system Group information for NIS groups (on an NIS master) Account information for NIS user accounts (on an NIS master) Protected password authentication database files (enhanced security only) Protected password database (enhanced security only) Protected password database (enhanced security only) Account Manager application Account Manager help volume Account Manager help volume for enhanced security Directory containing Account Manager application icons Application defaults file that sets the default values for the X resources Account Manager message catalog Default directory for user account initial files SEE ALSO
Commands: auditmask(8), authck(8), groupadd(8), groupdel(8), groupmod(8), login(1), nis_intro(7), passwd(1), secsetup(8), useradd(8), userdel(8), usermod(8), XIsso(8), XSysAdmin(8) Functions: acceptable_password(3), getprpwent(3), getpwent(3) Files: authcap(4), default(4), group(4), passwd(4) Manuals: System Administration, Advanced Server for UNIX Installation and Administration, Advanced Server for UNIX Concepts and Plan- ning</docbook> dxaccounts(8)