%%% Bernd Raichle: read only first line of an input file
You have a \TeX{} input file with more than one line:

\beginverbatim
test file 1 -- line 1 \count0=42
test file 1 -- line 2 \count0=31415
test file 1 -- line 3 \count0=1
... more lines ...
\endverbatim

You can use the following trick, if you want to process only the first line
of this file:

\beginverbatim
\endinput \input testfile
\endverbatim

This will produce the following output:

\beginverbatim
test file 1 -- line 1
\endverbatim

{\bf Background:}
The primitive \type{\endinput} does not close the current file immediately. It sets
a \TeX{} internal flag that indicates that if the next end-of-line is processed
the current file is closed. Thus all the tokens after the \type{\endinput} until the
end of the line are processed. If you start reading a new file after
\type{\endinput} this file will become the current file and it will be closed after
the first end of line is seen.

\beginverbatim
\immediate\openout0=\jobname.out
\immediate\write0{test file 1 -- line 1 \count0=42}
\immediate\write0{test file 1 -- line 2 \count0=31415}
\immediate\write0{test file 1 -- line 3 \count0=1}
\immediate\closeout0
...
\endinput\input zz.out (\the\count0) \end
\endverbatim

% \endinput
As a result we get:\bigskip

\immediate\openout0=\jobname.out
\immediate\write0{test file 1 -- line 1 \count0=42}
\immediate\write0{test file 1 -- line 2 \count0=31415}
\immediate\write0{test file 1 -- line 3 \count0=1}
\immediate\closeout0
...
\endinput\input\jobname.out (\the\count0)
