From:"Alfa rOMEO" <[EMAIL PROTECTED]>To:[EMAIL PROTECTED]:Please help Simple Perl programmDate:Fri, 06 Dec 2002 21:32:22 +0000Mime-Version:1.0Content-Type:text/plain; format=flowedMessage-ID:<[EMAIL PROTECTED]>
Plain Text Attachment [ Save to my Yahoo! Briefcase | Download File ] >>Hi,>>>I have a problem and search for a simple perl solution:>>Here are the >task:>>>Source File: Domainname <TAB> Username <TAB> Field <TAB> >Fieldname>>>Example: Test <TAB> Peter <TAB> FAX <TAB> 0112345678>>>>I want search in >the source file after a special entry in the Fieldname >>. >>Want to read the >Username and write then all lines with this username >>in a >>new file. Assuming you have all the entries in a list @enties, and want to search for all lines with Peter, how about this: open MYFILE,"myfile.txt" || die $!; # Open your output file select MYFILE; #So you don't have to specify it evrytime you print foreach(@entries){ if( /(Test \t Peter \t FAX \t 0112345678)/ ){ #if the line contains Peter store its contents in $1 print $1; #...then write that to your file } }close MYFILE; --------------------------------- Do you Yahoo!? Yahoo! Mail Plus - Powerful. Affordable. Sign up now