Print lines in file from the match line until end of file

This is for a really old version of GNU sed on Windows

GNU sed version 2.05

http://www.gnu.org/software/sed/manual/sed.html

-n only display if Printed
-e expression to evaluate
p stands for Print
$ end of file
line1,line2 is the range
! is NOT

haystack.txt

abc
def
ghi
needle
want 1
want 2

Print matching line and following lines to end of file

>sed.exe -n -e "/needle/,$p" haystack.txt
needle
want 1
want 2

Print start of file up to BUT NOT including matching line

>sed.exe -n -e "/needle/,$!p" haystack.txt
abc
def
ghi

Print start of file up to AND including matching line

>sed.exe -n -e "1,/needle/p" haystack.txt
abc
def
ghi
needle

Print everything after matching line

>sed.exe -n -e "1,/needle/!p" haystack.txt
want 1
want 2

Print everything between two matches - inclusive

>sed.exe -n -e "/def/,/want 1/p" haystack.txt
def
ghi
needle
want 1

sed -n '/matched/,$p' file
awk '/matched/,0' file

Tags:

Sed