![]() |
|
|
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 |
| Adding columns of two files | chandra321 | Shell Programming and Scripting | 7 | 05-06-2009 01:11 PM |
| Comparing similar columns in two different files | ragavhere | Shell Programming and Scripting | 13 | 04-16-2008 09:53 AM |
| Comparing the common columns of a table in two files | ragavhere | SUN Solaris | 1 | 04-11-2008 09:41 AM |
| Comparing Columns of two FIles | ggopal | Shell Programming and Scripting | 4 | 02-21-2007 08:06 PM |
| Comparing Columns of two FIles | ggopal | UNIX for Advanced & Expert Users | 1 | 02-17-2007 04:11 AM |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
||||
|
comparing files - adding/subtracting/formating columns
I have two files:
file1.txt: FS Total Used Free Used% /u01 10000 8000 2000 80% /u02 10000 8000 2000 80% /u03 10000 8000 2000 80% /u04 10000 8000 2000 80% /u05 10000 8000 2000 80% /u06 10000 8000 2000 80% /u07 10000 8000 2000 80% /u10 10000 5000 5000 50% file2.txt: FS Adj /u01 1,500 /u05 500 /u10 2,500 I would like to compare them using the first column in each file and create an output from both that looks like the following: FS Total Used+Adj Free-Adj (Used+Adj)/Total --------- -------- --------- --------- --------- /u01 10,000 9,500 500 95% /u02 10,000 8,000 2,000 80% /u03 10,000 8,000 2,000 80% /u04 10,000 8,000 2,000 80% /u05 10,000 8,500 1,500 85% /u06 10,000 8,000 2,000 80% /u07 10,000 7,500 2,500 75% Please note that all lines from file1.txt are listed, and column "adj" of file2.txt is added to column "Used" and subtracted from column "Free" of file1.txt only if there is a match. I was able to produce this report only after loading these files into a database but I am sure I can do it using shell scripting with your help. Thanks, Omer |
| Bookmarks |
| Tags |
| solaris |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|