NAME

App::PerlGlue - glue messy text into useful shapes

SYNOPSIS

# text
echo 'Perl is glue' | perlglue upper
echo 'LOUD' | perlglue lower
perlglue lines app.log --where '$_ =~ /ERROR/'
perlglue replace 's/(?<=user=)\w+/REDACTED/g' app.log

# csv/jsonl
perlglue pick users.csv --csv name,email
perlglue convert users.csv --to jsonl
perlglue jsonl logs.jsonl '$_->{status} >= 500'
perlglue template users.csv 'Hello, {{name}}'

# filesystem
perlglue rename 's/\s+/_/g' *.txt

DESCRIPTION

App::PerlGlue provides the perlglue command-line program for practical text munging when simple one-liners become hard to maintain.

It focuses on connecting line-based text, CSV-ish input, and JSON Lines with a single command surface and Perl expressions.

COMMANDS

help

Show built-in usage text.

version

Print the installed perlglue version.

upper

Read STDIN and write uppercase text.

lower

Read STDIN and write lowercase text.

lines [file] [--where EXPR]

Read from a file (or STDIN if omitted) and print each line. When --where EXPR is provided, only lines where the Perl expression is true are printed. The current line is available in $_.

where [file] [EXPR]

Alias of lines. Accepts the filter expression either as positional EXPR or via --where.

replace 's/.../.../flags' [file]

Apply a Perl substitution expression to each input line and print the result. Input is read from file or STDIN.

pick FILE --csv fields

Extract selected CSV columns by header name. fields is a comma-separated header list (for example name,email).

convert FILE --to jsonl

Convert CSV rows into JSON Lines objects keyed by the CSV header row. Currently only --to jsonl is supported.

csv / from-csv

Aliases for convert.

jsonl [file] [EXPR]

Read JSON Lines, decode each line into $_, and print each object as JSON. If an expression is provided (or via --where EXPR), only matching objects are printed.

template FILE TEMPLATE

Apply simple {{field}} placeholder substitution for each CSV row. Fields are looked up from the CSV header.

rename 's/.../.../flags' files...

Safely rename files using a Perl substitution expression. The command fails if a target path already exists.

NOTES

  • CSV parsing currently uses Text::ParseWords::parse_line with comma separation and quote handling suitable for typical CLI data.

  • Filter and replacement expressions are evaluated as Perl code; use trusted input only.

AUTHOR

Shingo Kawamura <pannakoota@gmail.com>

LICENSE

This library is free software; you may redistribute it and/or modify it under the same terms as Perl itself.