![]() |
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 |
| UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !! |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Comparison Unix and Windows file sysytem | localp | UNIX for Dummies Questions & Answers | 1 | 04-11-2008 04:02 AM |
| Comparison of two files in awk | jerome Sukumar | Shell Programming and Scripting | 12 | 07-26-2006 08:16 AM |
| String Comparison between two files using awk | rudoraj | Shell Programming and Scripting | 7 | 07-25-2006 11:04 AM |
| Unix comparison | NewGuy100 | UNIX for Dummies Questions & Answers | 1 | 12-14-2005 04:42 PM |
| Unix Programming Book Comparison | theicarusagenda | High Level Programming | 6 | 03-04-2005 10:30 AM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread |
Rating:
|
Display Modes |
|
||||
|
Comparison of 2 files in UNIX
Hi, There are two files in UNIX system with some lines are exactly the same, some lines are not.
I want to compare these two files.The 2 files (both the files have data in Column format )should be compared row wise and any difference in data for a particular row should lead to storage of data of second file in another new third file. i.e here we are assuming second file( file 2 ) to be updated version of first file (file 1) and any difference in row wise matching would lead to storage of the updated /modified data in another third file . ![]() Please help me ASAP ![]() ![]() |
|
||||
|
hi yogesh diff is NOT solving the problem ( i have tried that)..
bcoz the output apart from giving the difference in file contents is also displaying line numbers and other special kind of instructions ... we got to pick up only the modified data from this third file .. so diff doesn't work out here properly for eg below is one such display 1c1,2 < 1|2|2|2|4|3 --- > 1|2|3|2|3|4 > Thank you do let us know in case of any other options ![]() |
|
||||
|
Porter here NOT all lines begin in same way/with same special characters
even i tried following the same stuff ( as suggested by u ) long time back diff file1 file2 > diff_file.txt cut -d"|" -f1 diff_file.txt|egrep -v ",|-|>|<" > final.txt field 1( f1) was the desired field which was to be picked up from the diff_file.txt file .. but again problem is that the diff_file.txt contained the line numbers in some places Also (note: diff_file.txt has huge number of rows of data) ,so these unwanted line numbers which lie in same column as the field 1 data also gets picked up with the field1 data eg line numbers like 4d3,5a5 etc Note :file 1 n file 2 contains numbers as data so i want final.txt file to have pure numbers only ![]() |
|
||||
|
Hey Vino thanks a lottt !!!!! ..but again ur suggestion is applicable only when both the files have certain contents which are unique to that particular file and NOT found in other one ...
for eg two files file3 having contents bat mat rat and file4 having contents bat rat hat in such case grep -vf file3 file4 would display only "hat" and not rat because rat is present there is file 3 ![]() but our criteria is that rat as well as hat should be displayed as we are matching the column contents row wise ONLY.. so here the values at second and third place of file 4 differ from those of file 3 so accordingly i want rat and hat to be displayed any idea ![]() |
| Sponsored Links | ||
|
|
![]() |
| Bookmarks |
| Tags |
| diff, grep, perl, perl shift, shift, shift perl |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|