[Za-pm] creating new file one line at a time

Anne Wainwright anotheranne at fables.co.za
Sun Mar 7 11:43:44 PST 2010


Hello, 

Hold fire, I have had some direct replies and one from James Keenan has
made me think that I have upstream issues with the creation of the
delimited file from the original source.

I'll post a resolution when this has been checked out.

Thanks all for the help so far.

Anne


On Sun, 7 Mar 2010 16:47:07 +0200
Anne Wainwright <anotheranne at fables.co.za> wrote:

> Hello,
> 
> import.txt is one record per line (imports fine into postgresql)
> all I want it to add one more '|' delimiter onto the end of each line
> before the newline, and save to delimited.txt
> but the following perl script does not do this.
> the output file is the same as the input
> 
> open (IMPORT, "import.txt") or die "file does not exist\n\n";
> open (RESULT, ">delimited.txt") or die "cannot create output
> file\n\n";
> 
> while (<IMPORT>) {
>     s/(\w)$/$1|/ ;
>     print RESULT $_ ;  # write line
> }
> 
> close (IMPORT) or die "cannot close input file: $!";
> close (RESULT) or die "cannot close output file: $!";
> 
> any ideas, please?
> since we are handling the records one at a time there should be no
> need for any modifier?
> 
> 
> Anne
> _______________________________________________
> Za-pm mailing list
> Za-pm at pm.org
> http://mail.pm.org/mailman/listinfo/za-pm


More information about the Za-pm mailing list