App-part

 view release on metacpan or  search on metacpan

README.mkdn  view on Meta::CPAN

    # keeping and reproducing one line of headers
    perl -w part.pl example.csv --header-line=1 --column=3 "--separator=,"

    # Split a tab separated file according to the second column
    perl -w part.pl example.tsv --column=2 --separator=009

# OPTIONS

- **--out** - set the output template

    If the output template is not given it is guessed from
    the name of the first input file or set to `part-%s.txt`.
    The `%s` will be replaced by the column value.

- **--column** - set the column to part on

    This is the zero-based number of the column.
    Multiple columns may be given.

- **--separator** - set the column separator

bin/part.pl  view on Meta::CPAN


    # Split a tab separated file according to the second column
    perl -w part.pl example.tsv --column=2 --separator=009

=head1 OPTIONS

=over 4

=item B<--out> - set the output template

If the output template is not given it is guessed from
the name of the first input file or set to C<part-%s.txt>.
The C<%s> will be replaced by the column value.

=item B<--column> - set the column to part on

This is the zero-based number of the column.
Multiple columns may be given.

=item B<--separator> - set the column separator

bin/part.pl  view on Meta::CPAN

    'version'           => \my $version,
) or pod2usage(2);
pod2usage(1) if $help;
if (defined $version) {
    print "$VERSION\n";
    exit 0;
};
pod2usage("$0: No files given.")  if ((@ARGV == 0) && (-t STDIN));

if (! defined $tmpl) {
    # Let's hope we can guess from the first filename
    my $placeholder = '-%s' x @col;
    ($tmpl = $ARGV[0] || 'part.txt') =~ s/\.(\w+)$/$placeholder.$1/;
};

if (! defined $sep) {
    $sep = "\t";
};

$filename_sep ||= "012";
if ($filename_sep =~ /^\d{3}$/) {



( run in 0.940 second using v1.01-cache-2.11-cpan-702932259ff )