Move old scripts into a subdir
This commit is contained in:
parent
b9a82c6e33
commit
6b49d958d8
7 changed files with 0 additions and 0 deletions
25
misc/yaml2csv
Executable file
25
misc/yaml2csv
Executable file
|
@ -0,0 +1,25 @@
|
|||
#!/usr/bin/env perl
|
||||
|
||||
use strict;
|
||||
use warnings FATAL => 'all';
|
||||
|
||||
use YAML::Any;
|
||||
use CSV::Writer;
|
||||
use Getopt::Long;
|
||||
|
||||
my @columns;
|
||||
|
||||
GetOptions(
|
||||
'columns=s@' => sub {
|
||||
my ( $opt, $value ) = @_;
|
||||
push @columns, split qr{\s*,\s*}, $value;
|
||||
}
|
||||
) and @columns > 0
|
||||
or die "Usage: $0 [--columns=...]\n";
|
||||
|
||||
my $csv = CSV::Writer->new( columns => \@columns );
|
||||
$csv->write( $csv->columns );
|
||||
|
||||
for my $d ( YAML::Any::LoadFile( \*STDIN ) ) {
|
||||
$csv->write( $d );
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue