NAME
Langertha::Holmgang::Shell::Filter - The text filters behind a pipe — grep, head, tail, wc, sort, uniq, cut, awk, tr, fold
VERSION
version 0.001
SYNOPSIS
use Langertha::Holmgang::Shell::Filter ();
my ( $text, $ok ) = Langertha::Holmgang::Shell::Filter::filter_output( $output, [ 'grep', '-i', 'wg0' ] );
# ( undef ) when the filter (or this program of it) is not modelled
DESCRIPTION
The filters a command's output goes through behind a |: used by the Linux simulator for its pipes and by the World for the output of observations. They work only on the text they are given.
filter_output
my $text = filter_output( $text, [ 'grep', '-i', 'wg0' ] );
Applies a filter command of a pipe: grep (-i, -v, -E, -F, -w, -c), head/tail (-n N, -N, -n -N, -n +N, -c N), wc (-l/-w/-m/-c, combined), sort (-n, -r, -u), uniq (-c, -d, -u), cut (-d, -f, -c), awk (a small part: -F, -v, BEGIN { FS/OFS = "…" } or BEGIN { print … }, patterns with == != < <= > >= (number or string like awk), ~/!~ with /re/, &&, ||, !, parentheses, NR, NF, $N, $NF, arithmetic + - * / %, length, int, substr, tolower, toupper; variables and arrays (a[k], k in a), assignments = += -= *= /= %= ++ --, if/else, for (k in a), END; actions print with fields, literals and concatenation, comma as OFS, printf; other functions, while, ?:, redirections and getline are a gap), tr (ranges, classes, -c/-d/-s), fold (-w N, -s), cat. Returns ( $text, $ok ), or ( undef ) when the command (or this program of it) is not modelled here.
SUPPORT
Issues
Please report bugs and feature requests at https://github.com/Getty/langertha-holmgang/issues.
IRC
Join #langertha on irc.perl.org or message Getty directly.
CONTRIBUTING
Contributions are welcome! Please fork the repository and submit a pull request.
AUTHOR
Torsten Raudssus <torsten@raudssus.de>
COPYRIGHT AND LICENSE
This software is copyright (c) 2026 by Torsten Raudssus <torsten@raudssus.de> https://raudssus.de/.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.