bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

combine and ..


From: Val Krem
Subject: combine and ..
Date: Tue, 19 Jan 2016 02:31:07 +0000 (UTC)


Hi John and all,

I am trying to write a bash script to do the following  small task


I have two files and each file has two variables.

File1
Name     weight1    height1
Alex            220            67
 Tom             320            75
Craig    180            71
John            186            65


File2 
Name     weight2  height2
Alex           226          69
Tom             320          75
Craig         170          70
Steve         420          80


Here are  my objectives,

1. Combine the two files (file1 and file2)
    a) count and List the name(s) along with their weight and height that 
appear in         file1 not in file2

                Name  Weight  height 
             eg John         186        65

    b) count and list the names(S) along with their  weight and height that 
appear in         file 2 but not in file1

            Name Weight height
            Steve      420         80

    c)  for those that appear in both file 1 and file 2, I want some  stat


    Name  weight1   height1  weight2  height2      w_diff  h_diff
    Alex         220          67           226          69                6     
      2
     Tom         320          75           320          75                0     
 0
    Craig        180          71           170          70              -10     
  -1

d) depending on the difference
    I want to list their names   along with their weight and height
      i)  increases in both variables
            Name weight1 height1 weight2 height2 w_diff h_diff
            Alex       220         67         226           69            6     
    2

    ii) decreases in both variables
              Name   weight1 height1 weight2 height2 w_diff h_diff
              Craig       180          71         170         70         -10    
    -1

    iii) decreases in either of the variables (weight or height)
             not in this example.  


Thank you in advance
val


reply via email to

[Prev in Thread] Current Thread [Next in Thread]