Sponsored Content
Top Forums Shell Programming and Scripting Compare few columns from two files Post 302356743 by manish44 on Sunday 27th of September 2009 09:30:20 AM
Old 09-27-2009
Sample Input file1 is MyFile1:
"America, LLC","265826","222111","04/01/2009","ddd, Nick","333","eRes-Plus - 333","ddk,Rubino ","R8","15","0.28","","0.00","0.28","","132. Proivdence Road Suite , TX 19063 US"
"America, LLC","265826","93659211","04/01/2009","Rose, Nick","3942489","eRes-Plus - 4102414180","Nick,Rubino ","R8","8","0.15","","0.00","0.15","","1400 N. test Road Suite 5025 x, PA 44333 US"
===================
Sample Input File2 is MyFile1
----------
"America, LLC",123456,44444,04/01/2009,"Russell,ddd",14444,eRes-Plus - 7043589536,"ddd,Russell",R8,43,1.05,,0,1.05,017653,201 S main St 1470 Charlotte court Charlotte 13322
"North, LLC",4444,1111114,04/01/2009,"Russell,ddd",1136671,eRes-Plus - 2159977710,"ddd,Russell",R8,42,1.03,,0,1.03,017653,201 S main St 1470 Charlotte court Charlotte 12345
=========================
Expected Output in to mismatch.csv , after compare the first 10 columns from above file 1 and file 2
FileName,column number, data in first file, data in 2nd file
MyFile1,2,265826,123456
MyFile1,3,222111,44444
Thank you,
Manish
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

How to compare two columns in two files?

Hello all, Could someone please let me know shell script or awk solution to compare two columns in two files? Here is the sample - file1.txt abc/xyz,M1234 ddd/lyg,M2345 cnn/tnt,G0123 file2.txt A,abc/xyz,kk,dd,zz,DCT,G0123,1 A,ddd/lyg,kk,dd,zz,DCT,M1234,1... (17 Replies)
Discussion started by: sncoupons
17 Replies

2. Shell Programming and Scripting

How to compare 2 files & get only few columns based on a condition related to both files?

Hiiiii friends I have 2 files which contains huge data & few lines of it are as shown below File1: b.dat(which has 21 columns) SSR 1976 8 12 13 10 44.00 39.0700 70.7800 7.0 0 0.00 0 2.78 0.00 0.00 0 0.00 2.78 0 NULL ISC 1976 8 12 22 32 37.39 36.2942 70.7338... (6 Replies)
Discussion started by: reva
6 Replies

3. UNIX for Dummies Questions & Answers

Compare Columns in two files

Hi all, I would like to compare a column in one file to a column in another file and when there is a match it prints the first column and the corresponding second column. Example File1 ABA ABC ABE ABF File 2 ABA 123 ABB 124 ABD 125 ABC 126 So what I would like printed to a file... (0 Replies)
Discussion started by: pcg
0 Replies

4. Shell Programming and Scripting

Compare Columns of two files

Hi I have file 1 like this and file 2 like this I need to compare column 3 of both files and delete lines in file1 with same column 3 values in two files. So the output is I tried with perl but didnt work. A perl code will be good as I am learning the language, but any other code would... (1 Reply)
Discussion started by: polsum
1 Replies

5. Shell Programming and Scripting

Compare columns in two different files using awk

Hi, I want to compare the columns of two files excluding column 2 from both the files. I tried this awk command. awk -F":" 'NR==FNR{++a;next} !(a)' file1.txt file2.txt . Example: File1.txt 123:09-15-2011:abc:123456 123:09-15-2011:abc:234567 123:09-15-2011:abc:345678 ... (5 Replies)
Discussion started by: shell_newbie
5 Replies

6. Shell Programming and Scripting

Compare multiple columns from 2 files

Hi, I need to compare multiple columns from 2 files. I can, for example, have these 2 files: file1: col1, col2, col3,col4 a,1,4,7 b,2,5,8 c,3,6,9file2: col1, col2, col3,col4 a,2,3,2 b,5,7,5 c,1,9,8As a result, I need for example the difference between the columns 2 and 4: col2,... (3 Replies)
Discussion started by: Subbeh
3 Replies

7. Shell Programming and Scripting

Compare columns in different files

Hi, I have two files like this: 8 1.3 10 1.3 12 1.3 15 1.3 21 1.3 and 1 2 3 4 10 11 15 16 21 22 (3 Replies)
Discussion started by: jamie_123
3 Replies

8. Shell Programming and Scripting

Compare 2 csv files by columns, then extract certain columns of matcing rows

Hi all, I'm pretty much a newbie to UNIX. I would appreciate any help with UNIX coding on comparing two large csv files (greater than 10 GB in size), and output a file with matching columns. I want to compare file1 and file2 by 'id' and 'chain' columns, then extract exact matching rows'... (5 Replies)
Discussion started by: bkane3
5 Replies

9. UNIX for Dummies Questions & Answers

Help need to compare columns in files

Hi, Below is my requirement file1 id|cnt 1|1 2|2 3|3 file2 id_1|cnt_1 1|1 2|1 3|1 I want to compare cnt and cnt_1 columns, if they are differ then give the details Am using below awk command, but the output is not as expected. (2 Replies)
Discussion started by: grandhirahuletl
2 Replies

10. UNIX for Dummies Questions & Answers

How to compare two columns in two files?

Hi All, I have a.dat file with content 1,338,30253395122015103,2015103,UB0085000,STMT151117055527002,,, 1,338,30253395122015103,2015103,UB0085000,STMT151117055527001,,, and b.dat having content 1,STMT151117055527001,a1.txt,b1.txt,c1.txt 1,STMT151117055527002,a2.txt,b2.txt,c2.txt ... (13 Replies)
Discussion started by: PRAMOD 96
13 Replies
INET_NTOP(3)						     Linux Programmer's Manual						      INET_NTOP(3)

NAME
inet_ntop - convert IPv4 and IPv6 addresses from binary to text form SYNOPSIS
#include <arpa/inet.h> const char *inet_ntop(int af, const void *src, char *dst, socklen_t size); DESCRIPTION
This function converts the network address structure src in the af address family into a character string. The resulting string is copied to the buffer pointed to by dst, which must be a non-NULL pointer. The caller specifies the number of bytes available in this buffer in the argument size. inet_ntop() extends the inet_ntoa(3) function to support multiple address families, inet_ntoa(3) is now considered to be deprecated in favor of inet_ntop(). The following address families are currently supported: AF_INET src points to a struct in_addr (in network byte order) which is converted to an IPv4 network address in the dotted-decimal format, "ddd.ddd.ddd.ddd". The buffer dst must be at least INET_ADDRSTRLEN bytes long. AF_INET6 src points to a struct in6_addr (in network byte order) which is converted to a representation of this address in the most appropri- ate IPv6 network address format for this address. The buffer dst must be at least INET6_ADDRSTRLEN bytes long. RETURN VALUE
On success, inet_ntop() returns a non-NULL pointer to dst. NULL is returned if there was an error, with errno set to indicate the error. ERRORS
EAFNOSUPPORT af was not a valid address family. ENOSPC The converted address string would exceed the size given by size. CONFORMING TO
POSIX.1-2001. Note that RFC 2553 defines a prototype where the last argument size is of type size_t. Many systems follow RFC 2553. Glibc 2.0 and 2.1 have size_t, but 2.2 and later have socklen_t. BUGS
AF_INET6 converts IPv4-mapped IPv6 addresses into an IPv6 format. EXAMPLE
See inet_pton(3). SEE ALSO
getnameinfo(3), inet(3), inet_pton(3) COLOPHON
This page is part of release 3.25 of the Linux man-pages project. A description of the project, and information about reporting bugs, can be found at http://www.kernel.org/doc/man-pages/. Linux 2008-11-11 INET_NTOP(3)
All times are GMT -4. The time now is 04:14 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy