in reply to match the second column and print rest of the column in horizontal form
#!/usr/bin/perl # http://perlmonks.org/?node_id=1172822 use strict; use warnings; $_ = do { local $/; <DATA> }; 1 while s/^\S+ +(\S.*?\S) .*\K\n.*? \1(?= )//m; print; __DATA__ 1..1524 chromosomal replication initiator protein DnaA NC_017524 +.1 1..1524 chromosomal replication initiator protein DnaA NC_016768 +.1 1..1524 chromosomal replication initiator protein DnaA NC_009565 +.1 1000808..1002415 oxidoreductase NC_009565.1 1000808..1002415 oxidoreductase NC_017528.1 1002441..1002704 hypothetical protein NC_016934.1 1002812..1003792 peptidoglycan-binding protein ArfA NC_017523.1 1002812..1003792 peptidoglycan-binding protein ArfA NC_021194.1 1002812..1003792 peptidoglycan-binding protein ArfA NC_018143.2 1002812..1003792 peptidoglycan-binding protein ArfA NC_020089.1
|
|---|