test.txt
Welcome notice
------------------------
Hello there, welcome! Foo
hello
world
Bar
Yes!
Foo
How are ya?!
Bar
Have a great day!
sed – grab text
$ sed -n '/Foo/,/Bar/p' test.txt
Output
Hello there, welcome! Foo
hello
world
Bar
Foo
How are ya?!
Bar
How to make this case-insensitive? For instance, say ‘FOO’ or ‘bAr’ will match the match pattern for sed? I tried with ‘I’, no luck. This should be a quick one, thanks guys!
If your sed supports it you can use I …
If not you will have to do something like