![]() |
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here. |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| compare 2 files.. | amon | Shell Programming and Scripting | 8 | 06-23-2008 10:34 AM |
| compare two files | charandevu | Shell Programming and Scripting | 7 | 03-30-2008 03:20 PM |
| Compare files | kharen11 | UNIX for Advanced & Expert Users | 25 | 03-14-2007 05:35 AM |
| compare files and beyond | MizzGail | UNIX for Dummies Questions & Answers | 2 | 04-25-2003 01:34 PM |
| compare files | ingunix | UNIX for Dummies Questions & Answers | 3 | 05-24-2001 11:44 AM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||
|
Hi,
I need to compare files in 2 recursive directories. I need to create a script which: 1. Unzip files recursive. 2. Check if all the files in one directory exist in the other, if not print out the file name. 3. Check if the content of the files are the same, if not the file name and different content will be displayed in a different file. Thanks ![]() |
|
||||
|
Compare 2 files with multiple fields
Hi,
Not sure if this is the right place. I'm having some trouble with a script. Basically I have 2 files, the first has the following format: 59382652678,59382652678,093582673 59382828082,59382828082,091531434 59382965276,59382965276,097447775 59385125137,59385125137,085430172 59385184928,59385184928,094012044 And the second file is much larger ($HOME/20080410_10*) 20537,59393495882,2008-04-10,35727,50,1,740010104911699, ,2,-14000,088807321,40553,0,0,9,0,0,088807321,,XXXX 1-7-9,0,0,0,0,-1,740011018811772,XXXXXX,,0,0,14000,0,0,XXXXXX,0,401D413D0E01DD,,,10,59397995026,59397995026,,0,0,0, 0,0,0,0,0,0,0,0,1,XXXX,50,61,0,9999,1,71340044,0,0,50,-1,0,1970-01-01 The second and third field of the first file corresponds to the 2nd and 18th field of the second file. I have worked on the script but I can only compare one field between the files ![]() for i in `ls $HOME/20080410_10*` do nawk -F, 'BEGIN {while ((getline < "'$file2'") > 0) file2_ar[$2] = $2; <<<< This is the second field, how do I assing the third filed??? OFS=","; } { if (file2_ar[$2] && $9==2) print file2_ar[$2],$0; } END{}' $i >> output.log done Does anyone have an idea on how it can be solved? Thanks, Last edited by newinawk; 05-19-2008 at 02:19 PM.. Reason: Opened new thread with issue |
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|