Wizard Health

Meza: Extract text from file

sinanmujan profile image Sinan Mujan ・1 min read

If you ever have a situation where you have a huge file and want to extract a certain portion from this file (e.g. a log file or database dump), you can use the sed command.

Sed is a stream editor that is used to perform basic text transformations on a file or input stream.


Extract between two patterns (or words):

sed -n '/beginning_pattern/,/end_pattern/p'

Extract from a pattern (word) to the end of the file:

sed -n '/beginning_pattern/,$p'

For more information about sed, check out this link.

Wizard Health

Building a better healthcare for the patients and the doctors.


markdown guide