projects
/
virtual-ldap
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
ba9db0e
)
create yaml dump files
author
Dobrica Pavlinusic
<dpavlin@rot13.org>
Tue, 13 Jul 2010 14:15:50 +0000
(14:15 +0000)
committer
Dobrica Pavlinusic
<dpavlin@rot13.org>
Tue, 13 Jul 2010 14:15:50 +0000
(14:15 +0000)
bin/csv2yaml-upisi2010.pl
patch
|
blob
|
history
diff --git
a/bin/csv2yaml-upisi2010.pl
b/bin/csv2yaml-upisi2010.pl
index
3f5b19e
..
3c69b04
100755
(executable)
--- a/
bin/csv2yaml-upisi2010.pl
+++ b/
bin/csv2yaml-upisi2010.pl
@@
-10,6
+10,9
@@
use YAML qw/DumpFile/;
use Text::CSV;
my $debug = 0;
use Text::CSV;
my $debug = 0;
+my $dir = 'yaml/hrEduPersonUniqueNumber_JMBG';
+
+mkdir $dir unless -e $dir;
my $path = shift @ARGV || die "usage: $0 file.csv\n";
my $path = shift @ARGV || die "usage: $0 file.csv\n";
@@
-22,7
+25,11
@@
while ( my $row = $csv->getline( $fh ) ) {
my ( $ulica, $grad ) = split(/\s*,\s*/, $row->[8]);
my $info = {
my ( $ulica, $grad ) = split(/\s*,\s*/, $row->[8]);
my $info = {
+ prezime => $row->[0],
+ ime => $row->[1],
jmbg => $row->[2],
jmbg => $row->[2],
+ datum_rodjenja => $row->[3],
+ email => $row->[4],
adresa_ulica => $ulica,
adresa_grad => $grad,
tel_fixed => $row->[9],
adresa_ulica => $ulica,
adresa_grad => $grad,
tel_fixed => $row->[9],
@@
-30,8
+37,9
@@
while ( my $row = $csv->getline( $fh ) ) {
spol => substr($row->[2],9,3) < 500 ? 'M' : 'F',
};
spol => substr($row->[2],9,3) < 500 ? 'M' : 'F',
};
- warn dump($row, $info);
- #DumpFile( "yaml/$uuid.yaml", $hash );
+ my $uuid = $row->[2];
+ DumpFile( "$dir/$uuid.yaml", $info );
+ warn "$uuid\n";
}
$csv->eof or $csv->error_diag();
close $fh;
}
$csv->eof or $csv->error_diag();
close $fh;