Group sums by matching and then multiplying by weights
Hi Experts,
Please help with the following.
I have 3 columns in File 1 , variables with values nested within groups.
Actual File1 has 8000 groups, and File 2 has 4000 variables.
the final evaluation of a group is defined as the sum of its variables.
I want to match the variable values with cols 3 and 4 respectively of file 2 , if matches col3 I want to give weight 1, if matches col4 I want to give weight -1, if not match any , give weight 0.
for example gr1 var1 has value a which matches File 2 var1 col3, so weight 1 is assigned... gr1 var2 has b which matches col4 for var2, so weight is -1, gr3 var3 has b which doesnt match col3 or col4 of var3 ,, so weight is given 0. For all missing values also weight is 0.
so the final evaluations are calculated as
group value = sum of ( weight x col2 in file 2 ) for only variables present in file 2. Ignore all other variables in file 1.
Desired output
Heres where I am stuck..
I have used integer numbers for simplicity but actual numbers are decimal in File 2.
Hi Guys,
I am trying to format my csv file. When I spool the file using sqlplus the single row output is wrapped on three lines.
Somehow I managed to format that file and finally i am trying to make the multiple line on single line.
The below command is working fine but I need to pass the... (3 Replies)
I'm looking for a script that sums the contents of a folder,
When you give a parameter to the script , i want to know the size of the directory, the number of files, number of folders,
These are commands that I have already found
du -s
find . -type f | wc -l
find . -type d | wc -ly
... (19 Replies)
HI,
i am trying to multiply 2 2D arrays (a,b) using fork.
The answer will be at c.
Each child have to calculate 1 row of c.
The code is right, as i think of it, with no errors but i dont get the correct c array...
I think there is maybe a mistake in i dimension ...
Anyway, here is the code:
... (16 Replies)
Hi, this is my code.It's simple : there are 2 2D arrays and the multiplied to C.
#include<stdio.h>
#include<sys/shm.h>
#include<sys/stat.h>
#include<stdlib.h>
main()
{
int *A; //A
int *B; //B
int *C; //C
int i,j,x,k,d;
int id;
... (17 Replies)
Please help me with commands for the following file operations
File description
5 columns in total , sorted by column 1 value
First formatting,
1) Records with duplicate column 1 values are to be ignored. Just consider the first occurrence of such a record.
2) Records with (column 2 -... (3 Replies)
Hi,
I am stuck with a problem, will be thankful for your guidance and help.
I have two files. Each line is a group of words with first word as group Id. eg. 'gp1' in File1 and 'grp1' in File2.
<File1>
gp1 : xyz xys3 syt2 ssx itt kty
gp2 : syt2 kgk iti op2
gp3 : ppy yt5 itt sky... (11 Replies)
Is there a way that i can get something like this to work:
Number=`expr 80 \* 10.69`
i.e. To multiply an integer by a decimal or a decimal by a decimal etc...?
thanks (10 Replies)
Hi
$ a=10 ; b=2
$ expr $a + $b
12
$ expr $a - $b
8
$ expr $a / $b
5
$ expr $a * $b
expr: syntax error
Any idean why I am getting this error only when multiplying two numbers. Whats the exact syntax?
Thanks a lot to all in advance
CSaha (5 Replies)
Let me explain my problem, I have a file in the following format
9602622 - User ID
01 -2 - Question number & Grade
02 - 3
03 - 7
04 - 12
05 - 9
06 - 0
9601664 - User ID
01 -2
02 - 3
03 - 7
04 - 12
05 - 9
06 - 0
I need to change the file so it looks like this
9601664 54 -... (1 Reply)
not entirely unix orientated but....
anyway i've got an old 486dx? 100 that i'll looking to turn into a unix running machine. But everytime i turn it on it comes up with and invalid CMOS checksum, after i've been into the set up and reset that it works fine, tried a new batter and that didn't sort... (1 Reply)