I have a log file with thousands of lines, some of those lines come in with garbage / binary data in them. The lines with that happening are junk and of no use to me I want to pattern match for the junk and simply do nothing with that line, all other lines get divided into 2 different output files. The code that I have below will separate the lines into output files but does not take into account the garbage. # Split the lines into the appropriate files. while (<LOGFILE>) { if ( (/JUNIPER/)||(/REDBACK/) ){ print DSL $_ ; } else { print DIALUP $_ ; } } I have included one good line and one garbage line in this post, be aware though that outlook and other mail clients will convert the control characters in the garbage to single characters so the garbage lines below is not 100% accurate but you should get the jist. Good line: "06/16/2004","00:11:02","CVX_GUAYNABO_OLD","Stop","[EMAIL PROTECTED]","200","username","10.xx.x4.1","1218","2","66.x3.x4.x7","7879592525","7877901623","C4536D6E:0005319",,"0", Garbage line: "06/16/2004","00:11:02","ARECIBO2","Stop","Unknown","Unknown","TÃâà eÃÅ<2yÃËÃÂÃÂÃÂÃÂ<8d>M(ÃÂQ<99>zqÃâÃÂÃÂÃÂÃÂ/ÃâkÃË<8a>ÃÅ,ÃÂ^ÃÂÃâÃÂ<80>ÃÂ<81><85>ÃÅ?ÃÂ<9b>ÃÂÃÅcÃÂX*AÃÂ<83>ÃâÂ>WÃÂÃÂ<8d>2<85>ÃÂÃËÃÂ9ÃI$ÃâÃâÃÅES_ÃâÃÂ2A0cÃÂRÃÂÃÅ+ÃÂÃÂ#ÃÂÃÂÃÂTÃÂÃÂ!kÃÂÃÂ<88>ÃÅÃÂÃÂnW<8a>ÃÂeÃâ<93><93>[ÃÂÃÂ><92>ÃÂhÃÂed<83><80>ÃÂvCÃÂ<90>ÃÂ","10.xx.x0.1","3145","7",,"7879592000","7878781076","C390F9EB:00182BC",,"0", Chris Hood Investigator Verizon Global Security Operations Center Email: <mailto:[EMAIL PROTECTED]> [EMAIL PROTECTED] Desk: 972.399.5900
Verizon Proprietary NOTICE - This message and any attached files may contain information that is confidential and/or subject of legal privilege intended only for the use by the intended recipient. If you are not the intended recipient or the person responsible for delivering the message to the intended recipient, be advised that you have received this message in error and that any dissemination, copying or use of this message or attachment is strictly forbidden, as is the disclosure of the information therein. If you have received this message in error please notify the sender immediately and delete the message.