Здравствуйте. Как правильно написать grep. Нужно найти значение и вывести весь блок который начитается со
Started и заканчивается
Completed Started POST "/institution/timesheets/ajax_filter_timesheets" for 127.0.0.1 at 2017-08-22 11:33:31 +0300
Processing by Institution::TimesheetsController#ajax_filter_timesheets as */*
Parameters: {"date_start"=>"01.08.2017", "date_end"=>"31.08.2017", "sort_field"=>"", "sort_order"=>"", "timesheet"=>{}}
Rendered institution/timesheets/ajax_filter_timesheets.js.erb (229.2ms)
Completed 200 OK in 780ms (Views: 587.7ms | ActiveRecord: 4.5ms)
Started GET "/institution/timesheets/dates?id=1191" for 127.0.0.1 at 2017-08-22 11:34:22 +0300
Processing by Institution::TimesheetsController#dates as HTML
Parameters: {"id"=>"1191"}
[1m[35m (28.0ms)[0m [1m[33m UPDATE timesheet_dates SET reasons_absence_id='2' WHERE id = 3083371
[0m
[1m[36mInstitution Load (1.0ms)[0m [1m[34mSELECT "institutions"."id", "institutions"."code", "institutions"."name", "institutions"."branch_id" FROM "institutions" WHERE "institutions"."id" = $1 LIMIT $2[0m [["id", 94], ["LIMIT", 1]]
Completed 200 OK in 582ms (Views: 411.4ms | ActiveRecord: 47.0ms)
Started POST "/institution/timesheets/ajax_filter_timesheet_dates" for 127.0.0.1 at 2017-08-22 11:34:23 +0300
Processing by Institution::TimesheetsController#ajax_filter_timesheet_dates as */*
Parameters: {"id"=>1191, "field_id"=>"", "timesheet"=>{"id"=>1191}}
Rendered institution/timesheets/ajax_filter_timesheet_dates.js.erb (5133.9ms)
Completed 200 OK in 13136ms (Views: 5467.0ms | ActiveRecord: 291.2ms)
Пока вот только написал выводит с начала файла и конец блока.
grep -Pzo "Star(.|\n)*?id = 308(.|\n)*?(?=\n{2})" ./log/development.log
а в результате нужен только блок
Started GET "/institution/timesheets/dates?id=1191" for 127.0.0.1 at 2017-08-22 11:34:22 +0300
Processing by Institution::TimesheetsController#dates as HTML
Parameters: {"id"=>"1191"}
[1m[35m (28.0ms)[0m [1m[33m UPDATE timesheet_dates SET reasons_absence_id='2' WHERE id = 3083371
[0m
[1m[36mInstitution Load (1.0ms)[0m [1m[34mSELECT "institutions"."id", "institutions"."code", "institutions"."name", "institutions"."branch_id" FROM "institutions" WHERE "institutions"."id" = $1 LIMIT $2[0m [["id", 94], ["LIMIT", 1]]
Completed 200 OK in 582ms (Views: 411.4ms | ActiveRecord: 47.0ms)