11

I am looking to grep an Apache access_log file from a specific date/time to the end of the file, so for example I want to grep from the first match of the following string to the end of the file:

19/Jan/2016:22:

What is the simplest way to do this?

2 Answers 2

17

Provided there are fewer than 999,999 lines:

grep -A 999999 '19/Jan/2016:22:' access_log

But this would be a better solution as it doesn't restrict the number of lines after the match:

sed -n '/19\/Jan\/2016:22:/,$p' access_log
4

use sed instead:

sed -n '\#19/Jan/2016:22:#,${/<regexp>/p}' access.log

where <regexp> is a sub-expression you would like to find in lines after 19/Jan/2016:22:

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .