Entering edit mode
6.5 years ago
Kritika
▴
260
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
No its not working it is not making any file ! No output
Hi, Are your files tab delimited?
cat -T input
is what result?its giving me what is there in file value of file1
if you are try to print first column -
awk '{print $1}' input
- does it work? When I test my on-liner on your pasted data above it is works.Yes its printing the first column
The above code is not making any file
The columns are seperated by 2 spaces