The UNIX and Linux Forums  

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



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
select values based on keys repinementer Shell Programming and Scripting 3 08-06-2009 06:12 AM
To Delete the repeated occurances and print in same line by appending values shaliniyadav Shell Programming and Scripting 8 06-26-2009 02:27 AM
How to print Dissimilar keys and their values? repinementer Shell Programming and Scripting 4 05-28-2009 12:45 PM
Extract multiple repeated data from a text file apjneeraj Shell Programming and Scripting 5 04-14-2009 03:40 AM
comparing the columns in two files bab123 Shell Programming and Scripting 1 07-28-2008 03:48 AM

 
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
Prev Previous Post   Next Post Next
  #1 (permalink)  
Old 08-25-2009
repinementer repinementer is offline
Registered User
  
 

Join Date: Mar 2009
Posts: 158
comparing the values of repeated keys in multiple columns

Hi Guyz
The 1st column of the input file has repeated keys like x,y and z.
The ist task is if the 1st column has unique key (say x) and then need to consider 4th column, if it is + symbol then subtract 2nd column value with 3rd column value (we will get 2(10-8)) or if it is - symbol subtract 3rd column value with 2nd(we ll get 4 (14-10)) after that output the line with low value(2) i.e. x 10 8 + and the same follows to y and z.....etc.

Thnx
input
Code:
x   10   8   +      
x   10   14  -     
y   10   8   +     
y   10   11  -   
z   10   8   +
output
Code:
x   10   8   +  
y   10   11  - 
z   10   8   +
 

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 05:42 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0