Usando grep
:
$ grep "^\[[0-9]\+\]:" file.txt
[25]:0.00843832,469:0.0109533):0.00657864,((((872:0.00120503,((980:0.0001
[29]:((962:0.000580339,930:0.000580339):0.00543993 ((758:0.000598847,726:0.000598847)
Para salvar a saída em um arquivo ( output.txt
):
grep "^\[[0-9]\+\]:" file.txt > output.txt
Usando python
:
#!/usr/bin/env python2
import re
with open('/path/to/file.txt') as f:
print '\n'.join([line.rstrip() for line in f if re.search(r'^\[\d+\]:', line)])