App-CSVUtils

 view release on metacpan or  search on metacpan

lib/App/CSVUtils/Manual/Cookbook.pod  view on Meta::CPAN

## no critic: TestingAndDebugging::RequireUseStrict
package App::CSVUtils::Manual::Cookbook;

# AUTHORITY
# DATE
our $DIST = 'App-CSVUtils'; # DIST
# VERSION

1;
# ABSTRACT: App::CSVUtils cookbook

__END__

=pod

=encoding UTF-8

=head1 NAME

App::CSVUtils::Manual::Cookbook - App::CSVUtils cookbook

=head1 VERSION

This document describes version 1.036 of App::CSVUtils::Manual::Cookbook (from Perl distribution App-CSVUtils), released on 2025-02-04.

=head1 DESCRIPTION

This document lists the various tasks you can do with the scripts included in
L<App::CSVUtils> distribution.

Example F<1.csv> content:

 name,age,rank
 andi,25,120
 budi,28,115
 cinta,19,142
 derry,33,121

Example F<2.csv> content:

 name,gender
 andi,M
 budi,M
 cinta,F
 erni,F

=head1 ADDING FIELDS

With L<csv-add-field>, we add a new field named C<foo> with the content
calculated from Perl code:

 % csv-add-fields 1.csv foo -e '$main::rownum * 2'
 name,age,rank,foo
 andi,25,120,4
 budi,28,115,6
 cinta,19,142,8
 derry,33,121,10

You can specify at which position the new field will be using one of the options
C<--at>, C<--after>, C<--before>.

=head2 Adding a field containing line number

 % csv-add-fields 1.csv linenum --at 1 -e '++$i'
 linenum,name,age,rank
 1,andi,25,120
 2,budi,28,115
 3,cinta,19,142
 4,derry,33,121

Other ways:

 % csv-add-fields 1.csv linenum --at 1 -e '$rownum-1'
 % csv-add-fields 1.csv linenum --at 1 -e '$data_rownum'

See also: L</Adding line number to CSV rows>.

=head1 ADDING ROWS

TODO.

=head1 ADDING SUMMARY ROW (TOTAL, AVERAGE, ETC)

TODO.



( run in 1.586 second using v1.01-cache-2.11-cpan-39bf76dae61 )