I'm working with a very large data set in the format:
chr1 45162 . . C T chr1 45162 . . C T chr1 45162 A . . T chr1 45162 . . C T chr1 45257 A . . T chr1 45257 A . . T chr1 45413 A . . T chr1 46844 A . C . chr1 72434 A G . . chr1 72434 A G . . chr1 72434 A G . . chr1 72434 A G . . chr1 72515 A . C . chr1 72515 A . . T chr1 77689 A G . .
The output I would like is this:
chr1 45162 A . C T chr1 45257 A . . T chr1 45413 A . . T chr1 46844 A . C . chr1 72434 A G . . chr1 72515 A . C T chr1 77689 A G . .
Essentially, for each unique value in column 2, I need to see all the attributes it has, which might be stored on separate lines.
So, if I had:
chr1 100 A . C . chr1 100 . G . T
I'd want the line in the output to be:
chr1 100 A G C T
I have a script that I believe is working correctly, but it is much too slow. I think there must be a much easier way to do this in a simple
My current version is here: http://ideone.com/e.js/ETBRz3
But, like I said, I think there should be an almost 1 liner version possible using only
All suggestions welcome.
(If it simplifies things, I can go back and modify the script that generated this file such that empty fields are an empty string rather than a "." character.)