Asunto: RE: How do I read groups of 9 lines from a file into 1 record? Unsubscribe Unsubscribe "*" Unsubscribe *
Unsubscribe me, please, from all of these lists. Bye, Leandro. > -----Original Message----- > From: <[EMAIL PROTECTED]> > Sent: Friday, April 19, 2002 4:28 PM > To: [EMAIL PROTECTED] > Subject: How do I read groups of 9 lines from a file into 1 record? > > I have a file of names and addresses. Each name and address is over nine > lines (including blanks). I want to use this file in a word document as > an > address list. > > My attempt so far has resulted in every line being printed nine times. > Help > please... > > > #!/usr/contrib/bin/perl > # open the input file > open(INFILE, '<address.txt'); > # open the output > open(OUTFILE, '>addline.txt'); > # read the whole file > #While there are lines in the infile > #For each 9 lines print the lines, print a new line, reset counter > while(<INFILE>) > { > $ThisLine = $_; > { for ($i = 1; $i <= 9; $i +=1) > {print OUTFILE $ThisLine; print OUTFILE ","; next} > } > print OUTFILE "\n"; > $i = 1; > } > close(INFILE); > close(OUTFILE); > > > > > Cathy > > Cathy Gear > e-mail: [EMAIL PROTECTED] > -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]