How to print all lines after a match up to the end of the file

grepsedtext processing

Input file1 is:

dog 123 4335
cat 13123 23424 
deer 2131 213132
bear 2313 21313

I give the match the pattern from in other file ( like dog 123 4335 from file2).

I match the pattern of the line is dog 123 4335 and after printing
all lines without match line my output is:

cat 13123 23424
deer 2131 213132
bear 2313 21313

If only use without address of line only use the pattern, for example 1s
how to match and print the lines?

Best Answer

In practice, I'd probably use Aet3miirah's answer most of the time, and alexey's answer is wonderful for navigating through the lines (also, it works with less). OTOH, I really like another approach (which is kind of the reversed Gilles' answer):

sed -n '/dog 123 4335/,$p'

When called with the -n flag, sed does not print by default the lines it processes anymore. Then we use a 2-address form that says to apply a command from the line matching /dog 123 4335/ until the end of the file (represented by $). The command in question is p, which prints the current line. So, this means "print all lines from the one matching /dog 123 4335/ until the end."

Related Question