[Koha] Problem uploading patrons

Paul Hoffman paul at flo.org
Thu Apr 4 03:31:32 NZDT 2019


On Tue, Apr 02, 2019 at 11:36:36AM -0700, Elaine Bradtke wrote:
> It has taken a while to figure out what caused the patron import to fail.
> The CSV file that failed has returns between each patron instead of new
> line.   Koha doesn't parse returns as new lines and so the file kept
> failing.
> Unfortunately, the software that we get the data from exports it with
> returns instead of new lines, and there's not a way to fix it on their end.
> I'd like to find a way to convert the returns to new lines so that the
> assistant librarian can do the uploads without my intervention. Excel
> doesn't seem to do the trick, unless there's a secret setting somewhere (if
> you know, do tell!).  Does Open Office work better?

In Linux or UNIX, this command will do the trick:

    perl -i -p -e 'tr/\x0d/\x0a/' FILE

(Option -i means "change the file in place"; _perldoc perlrun_ can help 
you understand the other options.)

To do the same but keeping a backup with extension .bak:

    perl -i.bak -p -e 'tr/\x0d/\x0a/' FILE

To copy from FILE1 to FILE2, changing CR to LF:

    perl -p -e 'tr/\x0d/\x0a/' < FILE1 > FILE2

Paul.

-- 
Paul Hoffman <paul at flo.org>
Software Manager
Fenway Library Organization
550 Huntington Ave.
Boston, MA 02115
617-989-5032


More information about the Koha mailing list