Hi
I have 2 files as below
File 1
Chr Start End
chr1 120 130
chr1 140 150
chr2 130 140
File2
Chr Start End Value
chr1 121 128 ABC
chr1 144 149 XYZ
chr2 120 129 PQR
I would like to compare these files using awk; specifically if column 1 of file1 is equal to column 1 of file2 (and column 2 of file 1 if less than column 2 of file2 and column3 of file1 is greater than column 3 of file2).
I have very limited coding skills but I'm wondering if someone could help me with this. There are many threads about matching strings in two files, but I have no idea how to add a column from one file to another based on a matching string.
I'm looking to match column1 in file1 to the number following the string "Gene_" in file2.
Hi,
I want to compare two files based on the data in their first column. Both the files are not equal in their number of columns and number of entries or rows.
The entries (only the first column) of the file1 should be compared with the entries (only the first column) of the file2.
Hi Everyone
I am new to Unix shell scripting
Can anyone please explain me in detail how this command works
Code:
awk -F@ 'NR==FNR{A[$1]=$2;next}$3 in A{$3=A[$3]}1' file2 file1
The above command I got it from this forum, but unable to implement it as I am not getting how this works:mad:
I have two files abc.txt and xyz.txt
abc.txt
Code:
1,2,3,4
5,6,7,8
9,0,1,2
xyz.txt
Hi again,
I have monthly one-column files of roughly around 10 years. Is there a more efficient way to concatenate these files column-wise other than using paste command? For instance:
Code:
file1.txt
12
13
15
12
file2.txt
14
15
18
19
file3.txt
20
21
13
12
expected output (one file containing all the concatenated columns)
12 14 20
13 15 21
15 18 13
12 19 12
Thank you in advance.
Hi guys,
Does anyone know how to copy the first column and paste it as the second column in a file? :confused:
For example:
Input:
A 1 3
B 3 7
C 5 2
D 9 4
Output:
A A 1 3
B B 3 7
C C 5 2
D D 9 4
Thank you very much!!
I have a two files, file A and B, which have 5 columns, and each 5 columns are made up of random numbers, that means, numbers are all different.
Hello,
I'm struggling with the following problem in sh script:
Adding a column to the right-end of a file ("master-file": non-constant column number, tab and linux formatted) where the column is the 4th one of file1 (space and DOS formatted)
Changing the header of column 4 of file 1 at the same time would be great.
Tanks for help,
Lco
Hi All,
I have a fixedwidth file of length 3000. Now i want to copy a column of 4 chars i.e( length 1678-1681) to column 1127 1171 to the same file.
Please let me know how can i achive using a single command in fixed width file.
Also source column length is 4 chars and target column length is 45 chars.
So while coying the column the value should be left adjusted to the column.
thanks,
Kiran