The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

setop - Set operations (union, intersection, difference, symmetric diff) on lines of files

VERSION

This document describes version 0.11 of setop (from Perl distribution App-setop), released on 2016-09-26.

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.

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.

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.

HOMEPAGE

Please visit the project's homepage at https://metacpan.org/release/App-setop.

SOURCE

Source repository is at https://github.com/sharyanto/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) 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.