https://github.com/konimarti/catbox
Process every mbox message with a shell command.
https://github.com/konimarti/catbox
aerc filters mbox
Last synced: 5 months ago
JSON representation
Process every mbox message with a shell command.
- Host: GitHub
- URL: https://github.com/konimarti/catbox
- Owner: konimarti
- License: mit
- Created: 2022-11-02T23:34:28.000Z (over 3 years ago)
- Default Branch: master
- Last Pushed: 2023-10-03T08:33:09.000Z (over 2 years ago)
- Last Synced: 2025-10-07T10:01:12.015Z (9 months ago)
- Topics: aerc, filters, mbox
- Language: Go
- Homepage:
- Size: 6.84 KB
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# 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](https://github.com/ferdinandyb/caeml/).
### Installation
```sh
go install github.com/konimarti/catbox@latest
```
### Usage
Usage: `catbox [-h|-c ] `
### 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'"
```