The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com




View Single Post in the UNIX and Linux Forums - Click on the Thread or Permalink to View Entire Thread -->
  #1 (permalink)  
Old 07-29-2008
vasuki vasuki is offline
Registered User
  
 

Join Date: Jul 2008
Posts: 1
compare 2 coloum of 2 diff files using perl script

Hi,

i am new to perl scripting.. i am still learing it.. i am asked to write a perl script which should compare 2 coloums of 2 different files. if those 2 coloumn are same the script should store the both the lines in 2 diff files.

these are files,

file 1:
21767016 226112 char[]
19136520 797355 java.lang.String
17769368 307049 java.lang.Object[]
13981656 582569 java.util.HashMap$Entry
10867240 16650 int[]
9065616 559799 java.lang.String[]
9060192 79626 java.util.HashMap$Entry[]
6969384 23146 byte[]
6857664 285736 java.util.Vector


file 2:
21702192 904258 java.lang.String
20985320 360561 java.lang.Object[]
20524112 209810 char[]
12623280 525970 java.util.HashMap$Entry
10945080 678896 java.lang.String[]
9781432 10871 int[]
8302464 345936 java.util.Vector
8107104 337796 netscape.ldap.util.RDN
7620024 68357 java.util.HashMap$Entry[]
6515152 52272 * ConstMethodKlass

so i have to compare 3rd coloumn of these to 2 files, eg i have java.lang.string present in both so i want the script store these complete line of both the files in 2 diff files. These 2 files are big files.

please suggest me how can this be done. some one had suggested you can use the hash table implementation.

thanks,
Vasuki