I have a file with the following structure:
[Term] id: GO:0000001 name: mitochondrion inheritance namespace: biological_process def: "The distribution of mitochondria, including the mitochondrial genome, into daughter cells after mitosis or meiosis, mediated by interactions between mitochondria and the cytoskeleton." [GOC:mcc, PMID:10873824, PMID:11389764] synonym: "mitochondrial inheritance" EXACT  is_a: GO:0048308 ! organelle inheritance is_a: GO:0048311 ! mitochondrion distribution
This structure is repeated several times, like a dictionary. Each definition starts with
[Term] and it's separated from the following by an empty newline; not every definition ends with a line starting with
I want to grep some terms and retrieve the whole definition, so from
[Term] to the empty newline; i.e., the structure example shown before could be the result of
grep -i "mitochondria" myfile. How do I do it? The number of lines of each definition is not fixed, and the match could be at any point of the definition.
I'm not sure that
grep is the right tool to do it; the thing is that I want to match several words at once, so I started using
grep -i -e "match" -e "someothermatch". Is there some
regex that does the trick?
I work with Cygwin in a Windows environment, and apparently it supports PCRE.