Man pages sections > man8 > snsplit

snsplit - split an article stream into individual articles

snsplit,v0.3.8(8) System Manager's Manual snsplit,v0.3.8(8)


snsplit - split an article stream into individual articles


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


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.


is the program (with arguments) to run on each article. If prog... exits with any kind of failure, snsplit aborts.
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.


Expect input articles in rnews batch format instead.


snsplit sets some environment variables. If the environment already contains these variables, they will be overwritten.
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.
contains the size of the current article.
The number of lines in the head of the article, excluding the blank separator line.
The number of lines in the body of the article, excluding the blank separator line.
If any fields 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.


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.
Harold Tay N.B.