setop - Set operations (union, intersection, difference, symmetric diff) on lines of files
This document describes version 0.11 of setop (from Perl distribution App-setop), released on 2016-09-26.
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
setop treats files as a sets of lines, and performs operations between the sets.
setop
0 on success.
255 on I/O error.
99 on command-line options error.
I first wrote fileop in Ruby in 2003, since Ruby has nice + and - operators for arrays.
fileop
+
-
Rewrote in Perl in 2014. Script renamed to setop, changed command-line options a bit, now preserves order of lines.
--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.
--op union
--intersect
Shortcut for --op intersect.
--op intersect
--diff
Shortcut for --op diff.
--op diff
--symdiff
Shortcut for --op symdiff.
--op symdiff
--cross
Shortcut for --op cross.
--op cross
--ignore-case, -i
--ignore-all-space, -w
--glue=s
Glue character to use to combine lines when operation is cross.
Please visit the project's homepage at https://metacpan.org/release/App-setop.
Source repository is at https://github.com/sharyanto/perl-App-setop.
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.
perlancar <perlancar@cpan.org>
This software is copyright (c) 2016 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.
To install App::setop, copy and paste the appropriate command in to your terminal.
cpanm
cpanm App::setop
CPAN shell
perl -MCPAN -e shell install App::setop
For more information on module installation, please visit the detailed CPAN module installation guide.