Im not sure I follow completly, but it is close... line 3 is the multiple NM_, but only the second p. looks to be updated. Can you add comments if possible? Thank you .
Hello cmccabe,
In your post#5 you haven't mentioned that we need to change p.D79D after :, so I had written my logic to change D79D not before DOT, could you please post exact output you need so that I could try to help you.
Thanks,
R. Singh
This User Gave Thanks to RavinderSingh13 For This Post:
I apologize and below is the complete file2 is below, it is tab-delimeted and $12 may have multiple (up to 30) NM_ in it. In this file2 line 6 has multiple NM_ in $12 seperated by a ;. All the matching p. and both p. are updated if it matches file1. So using line 6 as an example the V in p.V98V and D in p.D79D.
The last thing I am going to do, though I have not thought that far ahead yet ... is since the V in p.V98V and D in p.D79D are the same, that is the letter before and after the digit are the same, print p.=, but only if the letters before and after the digit are the same. So in this case line 6 would look like
this is the ultimate goal but the last step and maybe it is easier to do at a later time. Thanks .
file2
desired output
Last edited by cmccabe; 09-12-2017 at 10:27 PM..
Reason: added details
Have you made any progress?
Here is my attempt.
I have added another loop over the ";"-separated parts in $12.
In each part it still cycles through all characters after "p.".
This User Gave Thanks to MadeInGermany For This Post:
I was having no luck and now I see why (or think I do anyway).... I was spiting but not cycling though and appending the new value. Thank you very much .
Trying to use awk to store the value of $5 in file1 in array x. That array x is then used to search $4 of file1 to find aa match (I use x to skip the header in file1). Since $4 can have multiple strings in it seperated by a , (comma), I split them and iterate througn each split looking for a match.... (2 Replies)
In the perl below I am trying to set/update the value of $14 (last field) in file2, using the matching NM_ in $12
or $9 in file2 with the NM_ in $2 of file1.
The lengths of $9 and $12 can be variable but what is consistent is the start pattern will always be NM_ and the end pattern is always
;... (4 Replies)
I am trying to create a cronjob that will run on startup that will look at a list.txt file to see if there is a later version of a database using database.txt as the source. The matching lines are written to output.
$1 in database.txt will be in list.txt as a partial match. $2 of database.txt... (2 Replies)
I am trying to use awk to match two files that are tab-delimited. When a match is found between file1 $1 and file2 $4, $4 in file2 is updated using the $2 value in file1. If no match is found then the next line is processed. Thank you :).
file1
uc001bwr.3 ADC
uc001bws.3 ADC... (4 Replies)
I am trying to match $1 in file1 with $2 in file2. If a match is found then $3 and $4 of file2 are copied to file1. Both files are tab-delimeted and I am getting a syntax error and would also like to update file1 in-place without creating a new file, but am not sure how. Thank you :).
file1
... (19 Replies)
If $1 in file1 matches $2 in file2. Then the value in $2 of file2 is updated to $1"."$2 of file2. The awk seems to only match the two files but not update. Thank you :).
awk
awk 'NR==FNR{A ; next} $1 in A { $2 = a }1' file1 file2
file1
name version
NM_000593 5
NM_001257406... (3 Replies)
Hi,
I need help with this-
input.txt :
L B white
X Y white
A B brown
M Y black
Read this input file and if 3rd column is "white", then add specific lines to another file insert.txt.
If 3rd column is brown, add different set of lines to insert.txt, and so on.
For example, the given... (6 Replies)
Help needed urgently please.
I have a large file - a few hundred thousand lines.
Sample
CP START ACCOUNT
1234556
name 1
CP END ACCOUNT
CP START ACCOUNT
2224444
name 1
CP END ACCOUNT
CP START ACCOUNT
333344444
name 1
CP END ACCOUNT
I need to split this file each time "CP START... (7 Replies)
Hi, I have 2 files that I have modified to basically match each other, however I want to determine what (if any) line in file 1 does not exist in file 2. I need to match column $1 and $2 as a single string in file1 to $1 and $2 in file2 as these two columns create a match.
I'm stuck in an AWK... (9 Replies)
My input:
File_1:
2000_t
g1110.b1
abb.1
2001_t
g1111.b1
abb.2
abb.2
g1112.b1
abb.3
2002_t
.
.
File_2:
2000_t Ali england 135
abb.1 Zoe british 150
2001_t Ali england 305
g1111.b1 Lucy russia 126 (6 Replies)