How to search a text file for strings between two tokens in Ubuntu terminal and save the output?
- by Blue
How can I search a text file for this pattern in Ubuntu terminal and save the output as a text file?
I'm looking for everything between the string "abc" and the string "cde" in a long list of data.
For example:
blah blah abc fkdljgn cde blah
blah blah blah blah blah abc skdjfn cde blah
In the example above I would be looking for an output such as this:
fkdljgn
skdjfn
It is important that I can also save the data output as a text file.
Can I use grep or agrep and if so, what is the format?