5

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?

12

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
3

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:

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.