my file looks like this
//
[297]((((21:0.125204,20:0.125204):0.00994299,(28:0.0790047,(7:0.0146105,5:0.0146105):0.0643943):0.0561423):0
segsites:
positions: 1 2 4 6 9 10 45 67 78 89
01010101010101010101010101011111010101
I would need to parse it into three different files
//
[297]((((21:0.125204,20:0.125204):0.00994299,(28:0.0790047,(7:0.0146105,5:0.0146105):0.0643943):0.0561423):0
then
segsites:
positions: 1 2 4 6 9 10 45 67 78 89
an
01010101010101010101010101011111010101
the problem is that there are not a fixed number of lines starting with the brackets and so on. the final line could start with either a 0 or an 1 and that is a problem as I dont know how to tell grep to search for either 0 or 1. I would need to grep for the []. then the segsites and the line below which includes the pos and then the numeric line with 01
segsites
line? 2. Issegsites
always followed by a singlepositions
line? And ispositions
always followed by a single line of zeroes and ones? To grep for zeros or ones:grep '^[01]*$'
. – muru Apr 26 '15 at 12:11segsites
orpositions
go to the second file? And all other lines go to the first line? – muru Apr 26 '15 at 12:18