---
name: "snsplit"
section: "8"
platform: "linux"
package: "sn"
version: "0.3.8-12"
release: "Debian 12 (Bookworm)"
platforms: ["linux"]
url: "https://new.carta.tech/snsplit"
---

# snsplit(8)

split an article stream into individual articles

## NAME

snsplit - split an article stream into individual articles

## SYNOPSIS

**snsplit** \[-*r*\] \[*field*... -\] *prog*...\

## DESCRIPTION

**snsplit** reads an article stream from descriptor 0 and splits it into separate articles, invoking *prog*... on each, with the article avaiable on descriptor 0.  This is useful as a quick-and-dirty way of filtering an article stream.

The incoming article stream is expected to be in wire format, with lines ending in CRLF, leading dots doubled, and delimited by a dot on a line by itself.

The article presented to *prog*... will have lines that end in a bare newline, will have all header lines unfolded, leading dots will be unstuffed, and the article will be terminated by end-of-file.

## ARGUMENTS

- *prog*...

  is the program (with arguments) to run on each article.  If *prog*... exits with any kind of failure, **snsplit** aborts.

- *field*...-

  are optional header field names.  If these are specified, the value of the first header field of that name will be exported into the environment.  This *field*... list must be terminated by the hyphen.  See also **ENVIRONMENT** below.

## OPTIONS

- \-**r**

  Expect input articles in rnews batch format instead.

## ENVIRONMENT

**snsplit** sets some environment variables.  If the environment already contains these variables, they will be overwritten.

- **SEQUENCE**

  If already set to a positive value, it is incremented for the first article.  If it isn't set, is set to one for the first article.  Thereafter it is incremented for each subsequent article. The value is always a 6-digit number with leading zeroes, and it can roll over.

- **BYTES**

  contains the size of the current article.

- **HEAD\_LINES**

  The number of lines in the head of the article, excluding the blank separator line.

- **BODY\_LINES**

  The number of lines in the body of the article, excluding the blank separator line.

- **FLD\_***FIELD*

  If any *field*s are specified on the command line, where *field* is the name of an article header field, then **FLD\_***FIELD* will be set to the value of *field*, where *FIELD* is the same as *field* but with lower case characters changed to upper case, and all hyphens changed to underscores.  Confusing?  If *field* is **message-id**, then **FLD\_MESSAGE\_ID** will be set to the value of the first Message-ID field in the current article, if there is one.

## EXIT CODES

**snsplit** exits 0 on success, 1 on usage error, 2 on system error, and 3 on article format error.  If *prog*... exits with other than 0, **snsplit** will also exit that value.
