NAME
setop - Set operations (union, intersection, difference, symmetric diff) on lines of files
VERSION
This document describes version 0.122 of setop (from Perl distribution App-setop), released on 2019-07-03.
SYNOPSIS
setop [OPTION]... FILE FILE ...
Examples:
% setop --union file1 file2 file3 ;# combine files, duplicate lines removed, order preserved
% setop --intersect file1 file2 file3; # show lines common in all three files
% setop --diff <(ls /path1) <(ls /path2) ;# show lines in /path1 not in /path2
DESCRIPTION
setop
treats files as a sets of lines, and performs operations between the sets.
EXIT CODES
0 on success.
255 on I/O error.
99 on command-line options error.
OPTIONS
--help, -h
Show help message and exit.
--version, -v
Show version and exit.
--op=S
Pick operation. Known operations are: union (return lines from the first file and others, duplicate lines removed [even duplicates from the same file], order preserved), intersect (return common lines found in every file, order preserved), diff (return lines found in the first file but not the second, duplicate removed, order preserved), symdiff (short for "symetric difference", return lines found in either file but not both, duplicate removed, order preserved), cross (short for "cross product", produce cross product from lines from each file).
--union
Shortcut for
--op union
.--intersect
Shortcut for
--op intersect
.--diff
Shortcut for
--op diff
.--symdiff
Shortcut for
--op symdiff
.--cross
Shortcut for
--op cross
.--ignore-case, -i
--ignore-all-space, -w
--glue=s
Glue character to use to combine lines when operation is cross.
--skip-chars=i
Number of characters to skip when comparing, much like the same option in uniq command.
Currently this is only implemented for
diff
operation.--check-chars=i
Number of characters to check when comparing, much like the same option in uniq command.
Currently this is only implemented for
diff
operation.
HISTORY
I first wrote fileop
in Ruby in 2003, since Ruby has nice +
and -
operators for arrays.
Rewrote in Perl in 2014. Script renamed to setop
, changed command-line options a bit, now preserves order of lines.
HOMEPAGE
Please visit the project's homepage at https://metacpan.org/release/App-setop.
SOURCE
Source repository is at https://github.com/perlancar/perl-App-setop.
BUGS
Please report any bugs or feature requests on the bugtracker website https://rt.cpan.org/Public/Dist/Display.html?Name=App-setop
When submitting a bug or request, please include a test-file or a patch to an existing test-file that illustrates the bug or desired feature.
SEE ALSO
AUTHOR
perlancar <perlancar@cpan.org>
COPYRIGHT AND LICENSE
This software is copyright (c) 2019, 2016, 2015, 2014 by perlancar@cpan.org.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.