HELP with Unix scripts in summing columns in a file.

Use and complete the template provided. The entire template must be completed. If you don't, your post may be deleted!

  1. The problem statement, all variables and given/known data:
    Hi guys, i'm a new guy here, and it's my first time creating a unix script.
    can you guys help me out here? i'd really appreciate it. :frowning:

Here's my problem:

This is the file i'm using, it has 6 columns, the first three columns are like the key columns, and i put one header row. I need to sum the values of 4th, 5th and 6th row, by grouping each row by date, prod id and store id.

1st file:
date		prod id	store id	amt 1	      amt 2	    amt 3
20111017	45671	11801	-12	      -12348	    1080
20111017	45671	11801	12	      12348	    1030
20111018	45672	11802	7	      7868	    990
20111018	45672	11802	4	      4496	    950
20111019	45673	11803	-12	      -12348	    910
20111019	45674	11804	12	      12348	    866

then i have this second file:
this file contains a list of "prod id's" that should be ignored in the first file.

2nd file:

prod id
45671

The third file consists of a list of "store id's" that should be ignored from the 1st file.

3rd file:

store id
11803

So basically, i need to come up with a script to sum the 4th, 5th and 6th columns of the first file, while taking consideration, those that are present in the 2nd and 3rd file, so that those that should be ignored should not be included when columns are summed.

I would really appreciate a lot of love and help and mercy from you guys.

Thanks a lot! :slight_smile:

  1. Relevant commands, code, scripts, algorithms:

  2. The attempts at a solution (include all code and scripts):

  3. Complete Name of School (University), City (State), Country, Name of Professor, and Course Number (Link to Course):

Note: Without school/professor/course information, you will be banned if you post here! You must complete the entire template (not just parts of it).

Is this actually homework or classwork?

it's actually a project in class, and it's due next week, i would really really appreciate it if you could help me in this. thanks a lot man.

You pasted the text "Note: Without school/professor/course information, you will be banned if you post here! You must complete the entire template (not just parts of it)" ...but don't appear to have actually read it.

I suggest you do.