I'm new at Perl and am a little intimidated by some of the syntax. I'd really appreciated any help I can get.
I have a file with multiple lines that have the same "key" . The output can have only one line per "key", but the information from all lines with like keys have to be in that one output line.
Input:
key col2 col3
1111 aaaa
1111 aaaa
1111 aaaa ffff
2222 bbbb eeee
2222 bbbb
3333 cccc
Output should look like this:
1111 aaaa ffff
2222 bbbb eeee
3333 cccc
So I guess what I'm trying to do is eliminate duplicate keys, but make sure I output all the information available. The third column will either be blank or have something in it. If it has something in it it will always be the same for that key.
Anybody have any ideas on how to accomplish this in Perl?
I have a file with multiple lines that have the same "key" . The output can have only one line per "key", but the information from all lines with like keys have to be in that one output line.
Input:
key col2 col3
1111 aaaa
1111 aaaa
1111 aaaa ffff
2222 bbbb eeee
2222 bbbb
3333 cccc
Output should look like this:
1111 aaaa ffff
2222 bbbb eeee
3333 cccc
So I guess what I'm trying to do is eliminate duplicate keys, but make sure I output all the information available. The third column will either be blank or have something in it. If it has something in it it will always be the same for that key.
Anybody have any ideas on how to accomplish this in Perl?