App-CSVUtils

 view release on metacpan or  search on metacpan

script/csv-cmp  view on Meta::CPAN

#!perl

# Note: This script is a CLI for Riap function /App/CSVUtils/csv_cmp/csv_cmp
# 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 = '2026-07-09'; # DATE
our $DIST = 'App-CSVUtils'; # DIST
our $VERSION = '1.038'; # VERSION

my $cmdline = Perinci::CmdLine::Any->new(
    url => "/App/CSVUtils/csv_cmp/csv_cmp",
    program_name => "csv-cmp",
    log => 1,
    read_config => 0,
    read_env => 0,
    use_utf8 => 1,
);

$cmdline->run;

# ABSTRACT: Compare two CSV files value by value
# PODNAME: csv-cmp

__END__

=pod

=encoding UTF-8

=head1 NAME

csv-cmp - Compare two CSV files value by value

=head1 VERSION

This document describes version 1.038 of csv-cmp (from Perl distribution App-CSVUtils), released on 2026-07-09.

=head1 SYNOPSIS

B<csv-cmp> B<L<--help|/"--help, -h, -?">> (or B<L<-h|/"--help, -h, -?">>, B<L<-?|/"--help, -h, -?">>)

B<csv-cmp> B<L<--version|/"--version, -v">> (or B<L<-v|/"--version, -v">>)

B<csv-cmp> [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<--detail|/"--detail, -l">>|B<L<-l|/"--detail, -l">>] [B<L<--exclude-field-pat|/"--ex...



See examples in the L</EXAMPLES> section.

=head1 DESCRIPTION

This utility is modelled after the Unix command C<cmp>; it compares two CSV files
value by value and ignore quoting (and can be instructed to ignore whitespaces,
case difference).

If all the values of two CSV files are identical, then utility will exit with
code 0. If a value differ, this utility will stop, print the difference and exit
with code 1.

If C<-l> (C<--detail>) option is specified, all differences will be reported. Note
that in C<cmp> Unix command, the C<-l> option is called C<--verbose>. The detailed
report is in the form of CSV:

 rownum,fieldnum,value1,value2

where C<rownum> begins at 1 (for header row), C<fieldnum> begins at 1 (first
field), C<value1> is the value in first CSV file, C<value2> is the value in the
second CSV file.

Other notes:

=over

=item * If none of the field selection options are used, it means all fields are
included (equivalent to C<--include-all-fields>).

=item * Field selection will be performed on the first CSV file, then the indexes will
be used for the second CSV file.

=back

=head1 OPTIONS

C<*> marks required options.

=head2 Main options

=over

=item B<--detail>, B<-l>

Report all differences instead of just the first one.

=item B<--ignore-case>, B<-i>

Ignore case difference.

=item B<--ignore-leading-ws>

Ignore leading whitespaces.

=item B<--ignore-trailing-ws>

Ignore trailing whitespaces.

=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<--ignore-ws>

Ignore leading & trailing whitespaces.

=item B<--quiet-arg>, B<-q>

Do not report, just signal via exit code.

=item B<--show-selected-fields>

Show selected fields and then immediately exit.



( run in 0.765 second using v1.01-cache-2.11-cpan-64ef6c95b5d )