Skip to content

Process every mbox message with a shell command.

License

Notifications You must be signed in to change notification settings

konimarti/catbox

Folders and files

NameName
Last commit message
Last commit date

Latest commit

c8916ad · Oct 3, 2023

History

8 Commits
Nov 3, 2022
Oct 3, 2023
Nov 3, 2022
Nov 3, 2022
Oct 3, 2023

Repository files navigation

catbox

catbox will pipe every message from an mbox file as an input to a shell command. A message counter is available as a shell variable $NR.

If no file is specified, catbox will read from stdin.

Inspired by caeml.

Installation

go install github.com/konimarti/catbox@latest

Usage

Usage: catbox [-h|-c <cmd>] <mbox>

Integration with aerc

Add this line to the [filters] section in your aerc.conf:

application/mbox=catbox -c caeml | colorize

Examples

The following examples assume that you have a file test.mbox in a valid mbox format in your local directory.

  • Show the message number counter:
catbox -c 'echo $NR' test.mbox`
  • Pipe every mbox message to caeml:
catbox -c caeml test.mbox
  • Save every mbox message in a separate file
catbox -c 'cat > message_$NR' test.mbox
  • Print only the first ten messages:
catbox -c "awk -v cbnr=\$NR '{if (cbnr>10) print}'" test.mbox
  • Read from stdin and only display the full message headers:
cat test.mbox | catbox -c "sed -n '1,/^\\s*$/p'"

About

Process every mbox message with a shell command.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages