Yes. You could do like this:
or a shell loop:
But this the most fun way of doing it -- recursive way:
You would save this as myPaste.sh, make it executable and then call it:
Note that all these above are dumb, they do not check whether the first 3 columns are the same, they just strip the first three column no matter what. The awk solution on 2 files with [$1,$2,$3] works on unsorted files also, and actually matches the first three fields. This could be extended to n files, would just need one extra loop in the END to sort the associative array.
Hello there:
I want to find common among files. They all have one column.
Format for data:
CEU_snp_CHR21.txt
21:10758305
21:10827533
21:10913441
21:10920098
21:10952160
21:10966322
21:10985991
NAT_CHR21_variants.txt
21:10971951 (3 Replies)
I have two files:
File_1:
@M04961:22:000000000-B5VGJ:1:1101:9280:7106 1:N:0:86
GGCATGAAAACATACAAACCGTCTTTCCAGAAATTGTTCCAAGTATCGGCAACAGCTTTATCAATACCATGAAAAATATCAACCACACCAGAAGCAGCAT
+
GGGGGGGGGGGGGGGGGCCGGGGGF,EDFFGEDFG,@DGGCGGEGGG7DCGGGF68CGFFFGGGG@CGDGFFDFEFEFF:30CGAFFDFEFF8CAF;;8F
... (3 Replies)
Good morning all,
I have a problem that is one step beyond a standard awk compare.
I would like to compare three files which have several thousand records against a fourth file. All of them have a value in each row that is identical, and one value in each of those rows which may be duplicated... (1 Reply)
Hi all !
I almost did it but got a small problem.
input:
cars red
cars blue
cars green
truck black
Wanted:
cars red-blue-green
truck black
Attempt:
gawk 'BEGIN{FS="\t"}{a = a (a?"-":"")$2; $2=a; print $1 FS $2}' input
But I also got the intermediate records... (2 Replies)
Dear all,
I have small script which seems to be working but seems to have some bug.
It suppose to read commonTxt and then print the noOfLines in outputFile.
It is working for most of the txt but unable to add some of the variables values.
Can somebody please spend looking at the thread and... (3 Replies)
input:
ref.1;rack.1;1 #group1
ref.1;rack.1;2 #group1
ref.1;rack.2;1 #group2
ref.2;rack.3;1 #group3
ref.2;rack.3;2 #group3
ref.2;rack.3;3 #group3
Among records from same group (i.e. with same 1st and 2nd field - separated by ";"), I would need to keep the last record... (5 Replies)
Hi, I have the following files,
A M 2 3
B E 4 5
C I 5 6
D O 4 5
A M 3 4
B E 5 2
F U 7 9
J K 2 3
OUTPUT
A M 2 3 3 4
B E 4 5 5 2
thanks in advance, (7 Replies)