Q. How do I find the text between the strings FOO and BAR inclusive using sed command line option?
A. Sed is a stream editor. A stream editor is used to perform basic text transformations on an input stream - a file or input from a pipeline.
To output all the text from file called test.xt' between 'FOO' and 'BAR', type the following command at a shell prompt. The -n option suppress automatic printing of pattern space:
$ sed -n '/WORD1/,/WORD2/p' /path/to/file
$ sed -n '/FOO/,/BAR/p' test.txt
You can easily find out all virtual host entries from httpd.conf, type
# sed -n '/<VirtualHost*/,/<\/VirtualHost>/p' /etc/httpd/conf/httpd.conf