I need to work on these text files. (fields are separated by commas)
$ cat File1.seed
389,0,
390,1,
391,0,
392,0,
393,0,SEED
394,0,
395,1,
$ cat File2.seed
223,0,
224,1,
225,0,
226,1,
227,0,SEED
228,1,
$ cat File3.seed
55,0,
56,0,SEED
57,1,
58,0,
59,1,
60,0,
and the desired output would be:
389,0,,223,0,,,,,0
390,1,,224,1,,,,,2
391,0,,225,0,,,,,0
392,0,,226,1,,55,0,,1
393,0,SEED,227,0,SEED,56,0,SEED,0
394,0,,228,1,,57,1,,2
395,1,,,,,58,0,,1
,,,,,,59,1,,1
,,,,,,60,0,,0
As you can see the files are aligned by the pattern "SEED", and then sum all the 2nd columns of the files horizontally adding the result in a last column.