Search Results

Search: Posts Made By: Akang
4,045
Posted By Akang
I think substr is not working. In the final...
I think substr is not working. In the final result i only get row names and column names.
4,045
Posted By Akang
@RudiC Is this what you mean? awk ' FNR == NR...
@RudiC Is this what you mean?
awk '
FNR == NR {T[$1] = $3
next
}
{printf "%s", $COL
}
X = substr($i, 1, 2)
FNR == 1 {for (X=COL+1; X<=NF; X++)
{if ($X in T) {C[++CNT] = X
F[CNT] = T[$X]...
4,045
Posted By Akang
I changed T[$1 SFX] = $3 to T[$1] = $3 but I...
I changed
T[$1 SFX] = $3 to T[$1] = $3
but I dont understand
use a substr of $i in the second

---------- Post updated at 05:42 PM ---------- Previous update was at 05:28 PM ----------

I...
4,045
Posted By Akang
1. Partial id matching, like i tried in R using...
1. Partial id matching, like i tried in R using match(substr)
2. if id matches,store the value file1$3
3.Multiply F[file1]*C[file2]
4.Print
5.Repeat till the end of both files

That's what I...
4,045
Posted By Akang
@RudiC Nothing wrong..but I am pretty new to...
@RudiC Nothing wrong..but I am pretty new to programming. So am struggling with adapting the awk script to my current need.
4,045
Posted By Akang
Matrix multiplication
I have two files. Row id in File1 matches the column id in file2 (starting from column7 )except the last 2 characters. File1 has 50 rows and File 2 has 56 columns. If the id matches I want to...
9,004
Posted By Akang
It was an OS issue I guess, Code works fine now....
It was an OS issue I guess, Code works fine now. Thanks @RudiC and @Don Cragun
9,004
Posted By Akang
@ RudiC sorry for that. But there is no error...
@ RudiC sorry for that. But there is no error now. I do get the output as mentioned in post 18. There are no errors but the output is not as desired.
9,004
Posted By Akang
@Don Cragun : I'm certain I did it right '...
@Don Cragun : I'm certain I did it right

' COL=2 SFX="_A" file2 file1

If I input the file1 first, this is the output
AMI1 A 0.4 3.1

B
9,004
Posted By Akang
@Don Cragun & RudiC: I am working on a Red Hat...
@Don Cragun & RudiC: I am working on a Red Hat Linux server.

---------- Post updated at 01:58 PM ---------- Previous update was at 11:44 AM ----------

Well, I did manage to run the code but...
9,004
Posted By Akang
Tried copying from the post to the command...
Tried copying from the post to the command prompt.. Shows several errors. Dont ' know what' s wrong
9,004
Posted By Akang
I did use the actual file names that i have. I...
I did use the actual file names that i have. I saved this code to a file and saved it as code.awk, then in the shell promp i type :awk code file2 file1 > output. Is it the right way?
Please use...
9,004
Posted By Akang
I dont' get any output when I run it :-( ...
I dont' get any output when I run it :-(

---------- Post updated at 10:04 AM ---------- Previous update was at 09:56 AM ----------

I dont' get any output at all :-(

---------- Post updated...
9,004
Posted By Akang
@Don Cragun In #Post5 i've tried to explain...
@Don Cragun
In #Post5 i've tried to explain the files and what output i'm looking for. It is a bit confusing though, ill try to explain here
#File1:Headings from column6 onwards contain either...
9,004
Posted By Akang
In the output file I need 1) Column "ID2" from...
In the output file I need
1) Column "ID2" from file1 : the unique record id
2)Columns ending with "_A": The values of these columns need to be multiplied with the 3rd column of file 2.
3)...
9,004
Posted By Akang
I dropped the columns i didnt require using awk...
I dropped the columns i didnt require using awk and then I tried this in R but no results.Ill appreciate any help. TIA!
index <- df2$Col1
df1[index]*df2$Col3[col(df1[index])]
9,004
Posted By Akang
Multiplication of two matrices
Hi there! I have two files like below
File1(with a header, ~1000 rows, ~50 columns)
ID1 ID2 ID3 ID4 ID5 MI1_A MI1_H MI2_A MI2_H
0 1 0 0 0 1 0 2 1
0 2 0 0 0 2 1 0 1

File2 (without a header,...
Showing results 1 to 17 of 17

 
All times are GMT -4. The time now is 07:34 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy