App-CSVUtils
view release on metacpan or search on metacpan
script/csv-check-cell-values view on Meta::CPAN
#!perl
# Note: This script is a CLI for Riap function /App/CSVUtils/csv_check_cell_values/csv_check_cell_values
# and generated automatically using Perinci::CmdLine::Gen version 0.502
use 5.010001;
use strict;
use warnings;
use Log::ger;
use Perinci::CmdLine::Any;
our $AUTHORITY = 'cpan:PERLANCAR'; # AUTHORITY
our $DATE = '2025-02-04'; # DATE
our $DIST = 'App-CSVUtils'; # DIST
our $VERSION = '1.036'; # VERSION
my $cmdline = Perinci::CmdLine::Any->new(
url => "/App/CSVUtils/csv_check_cell_values/csv_check_cell_values",
program_name => "csv-check-cell-values",
log => 1,
read_config => 0,
read_env => 0,
use_utf8 => 1,
);
$cmdline->run;
# ABSTRACT: Check the value of single cells of CSV against code/schema/regex
# PODNAME: csv-check-cell-values
__END__
=pod
=encoding UTF-8
=head1 NAME
csv-check-cell-values - Check the value of single cells of CSV against code/schema/regex
=head1 VERSION
This document describes version 1.036 of csv-check-cell-values (from Perl distribution App-CSVUtils), released on 2025-02-04.
=head1 SYNOPSIS
B<csv-check-cell-values> B<L<--help|/"--help, -h, -?">> (or B<L<-h|/"--help, -h, -?">>, B<L<-?|/"--help, -h, -?">>)
B<csv-check-cell-values> B<L<--version|/"--version, -v">> (or B<L<-v|/"--version, -v">>)
B<csv-check-cell-values> [B<L<--debug|/"--debug">>|B<L<--log-level|/"--log-level=s">>=I<level>|B<L<--quiet|/"--quiet">>|B<L<--trace|/"--trace">>|B<L<--verbose|/"--verbose">>] [B<L<--exclude-field-pat|/"--exclude-field-pat=s">>=I<re>|B<L<-A|/"--exclud...
See examples in the L</EXAMPLES> section.
=head1 DESCRIPTION
Example C<input.csv>:
ingredient,%weight
foo,81
bar,9
baz,10
Check that ingredients do not contain number:
% csv-check-cell-values input.csv -f ingredient --with-regex '/\\A[A-Za-z ]+\\z/'
Check that all %weight is between 0 and 100:
% csv-check-cell-values input.csv -f %weight --with-code '$_>0 && $_<=100'
=head1 OPTIONS
C<*> marks required options.
=head2 Main options
=over
=item B<--ignore-unknown-fields>
When unknown fields are specified in --include-field (--field) or --exclude-field options, ignore them instead of throwing an error.
=item B<--input-skip-num-lines>=I<s>
Number of lines to skip before header row.
This can be useful if you have a CSV files (usually some generated reports,
sometimes converted from spreadsheet) that have additional header lines or info
before the CSV header row.
See also the alternative option: C<--input-skip-until-pattern>.
=item B<--input-skip-until-pattern>=I<s>
Skip rows until the first header row matches a regex pattern.
This is an alternative to the C<--input-skip-num-lines> and can be useful if you
have a CSV files (usually some generated reports, sometimes converted from
spreadsheet) that have additional header lines or info before the CSV header
row.
With C<--input-skip-num-lines>, you skip a fixed number of lines. With this
option, rows will be skipped until the first field matches the specified regex
pattern.
=item B<--print-validated>
Print the validated values of each cell.
When validating with schema, will print each validated (possible coerced,
filtered) value of each cell.
=item B<--quiet-arg>, B<-q>
(No description)
=item B<--show-selected-fields>
Show selected fields and then immediately exit.
=item B<--with-code-json>=I<s>
Check with Perl code (JSON-encoded).
See C<--with-code>.
=item B<--with-code>=I<s>
Check with Perl code.
Code will be given the value of the cell and should return a true value if value
is valid.
=item B<--with-regex>=I<s>
(No description)
=item B<--with-schema-json>=I<s>
Check with a Sah schema (JSON-encoded).
See C<--with-schema>.
=item B<--with-schema>=I<s>
Check with a Sah schema.
=back
=head2 Field selection options
=over
=item B<--exclude-all-fields>
Shortcut for --exclude-field-pat=.*, effectively excluding all fields.
See C<--exclude-field-pat>.
=item B<--exclude-field-pat>=I<s>
Field regex pattern to exclude, takes precedence over --field-pat.
=item B<--exclude-field>=I<s@>, B<-F>
Field names to exclude, takes precedence over --fields.
( run in 1.356 second using v1.01-cache-2.11-cpan-140bd7fdf52 )