I want to extract all the lines in a file containting these patterns: "#1:" and "tree length for".
Input:
#1: nexus0002_Pseudomonas_10M
branch t N S dN/dS dN dS N*dN S*dS
6..5 0.000 390.0 195.0 0.0668 0.0000 0.0000 0.0 0.0
6..7 0.013 390.0 195.0 0.0668 0.0008 0.0114 0.3 2.2
7..1 0.000 390.0 195.0 0.0668 0.0000 0.0000 0.0 0.0
7..4 0.000 390.0 195.0 0.0668 0.0000 0.0000 0.0 0.0
6..8 0.000 390.0 195.0 0.0668 0.0000 0.0000 0.0 0.0
8..2 0.013 390.0 195.0 0.0668 0.0008 0.0114 0.3 2.2
8..3 0.013 390.0 195.0 0.0668 0.0008 0.0114 0.3 2.2
tree length for dN: 0.0023
tree length for dS: 0.0341
#1: nexus0003_Pseudomonas_10M
branch t N S dN/dS dN dS N*dN S*dS
6..5 0.000 390.0 195.0 0.0668 0.0000 0.0000 0.0 0.0
6..7 0.013 390.0 195.0 0.0668 0.0008 0.0114 0.3 2.2
7..1 0.000 390.0 195.0 0.0668 0.0000 0.0000 0.0 0.0
7..4 0.000 390.0 195.0 0.0668 0.0000 0.0000 0.0 0.0
6..8 0.000 390.0 195.0 0.0668 0.0000 0.0000 0.0 0.0
8..2 0.013 390.0 195.0 0.0668 0.0008 0.0114 0.3 2.2
8..3 0.013 390.0 195.0 0.0668 0.0008 0.0114 0.3 2.2
tree length for dN: 0.0111
tree length for dS: 0.0444
Output:
#1: nexus0002_Pseudomonas_10M
tree length for dN: 0.0023
tree length for dS: 0.0341
#1: nexus0003_Pseudomonas_10M
tree length for dN: 0.0111
tree length for dS: 0.0444
Is there any simple sed solution?