Question: How to replace row with another row in linux having NA and nucleotide bases

0

Kritika •

**260**wrote:I have file 1:

```
A1 1 NA
A1 2 NA
A1 3 NA
A1 4 A
A1 5 G
A1 6 T
A1 7 NA
A1 8 NA
A1 9 NA
A2 1 NA
A2 2 NA
A2 3 T
A2 4 NA
```

And file 2:

```
A1 4 A
A1 5 C
A1 6 T
A2 3 T
```

I want to replace row number 4,5,6 and 3 of A2 from file 1 with a value of 4,5,6 and 3 from file 2

**Expected Output in new file3:-**

```
A1 1 NA
A1 2 NA
A1 3 NA
A1 4 A
A1 5 C
A1 6 T
A1 7 NA
A1 8 NA
A1 9 NA
A2 1 NA
A2 2 NA
A2 3 T
A2 4 NA
```

I want to try this in Linux. I tried googling but I could not find better answers.

I tried in linux.

```
diff file2 file1
join -a 2 file2 file1 | cut -d ' ' -f -2
```

But i am not getting answers