Hi all, Here is the script I finally came up with. For some reason I need to find \n within "context" i.e. possible surrounding white spaces and \n.
Daniel -- my $outputFile = "Out_input.txt"; open (INPUTFILEHANDLE, "input.txt"); open (OUTPUTFILEHANDLE, ">". $outputFile); $/ = undef; $theFile = <INPUTFILEHANDLE>; # remove all trailing \n $theFile =~ s/(\s{0,})(\n{1,})/ /g; # add to each end of field delimiter a \n $theFile =~s/}~/}~\n/g; # add to each end of record delimniter a \n $theFile =~s/\|/\|\n/g; # remove trailing spaces after a \n $theFile =~ s/\n(\s{1,})/\n/g; print OUTPUTFILEHANDLE $theFile . "\n"; close OUTPUTFILEHANDLE; close INPUTFILEHANDLE; exit 0; _______________________________________________ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs