必要なのは
、行全体を削除する必要がありますが、一致する文字列を保持する必要があるということです。
Unhandled
で始まり、で終わるマッチングパターン:
一致するパターンを出力する以下のコードを試しましたが、ファイルから余分な行を削除する必要があります。
perl -0777 -ne 'print "Unhandled error at$1\n" while /Unhandled\ error\ at(.*?):/gs' filename
以下はサンプル入力です。
2012-04-09 01:52:13,717 --uhrerror --ERROR-22866-/home/shabbir/web/middleware.py process_exception --217-/ user / resetpassword/での未処理のエラー::{'mod_wsgi.listener_port': '8080 '、' HTTP_COOKIE': "__utma = 1.627673239.1309689718.1333823126.1333916263.156; __utmz = 1.1333636950.152.101.utmgclid = CMmkz934na8CFY4c6wod_R8JbA | utmccn =(not%20set)| utmcmd =(not%20set ; subpopdd = yes; _msuuid_1690zlm11992 = FCC09820-3004-413A-97A3-1088EE128CE9; _we_wk_ls _ =%7Btime%3A'1322900804422'%7D; _msuuid_lf2uu38ua0 = 08D1CEFE-3C19-4B9E-8096 = 1; __utmb = 1.7.10.1333916263;'wsgi.file_wrapper':、'HTTP_ACCEPT_ENCODING':'gzip、deflate'}