# [NTG-context] Removing banner from mtxrun output

Tue Sep 21 22:18:42 CEST 2010

On Tue, 21 Sep 2010, Peter Münster wrote:

> On Tue, Sep 21 2010, Johan Sandblom wrote:
>
>> Is there a way to instruct
>> \typefile to ignore the last four lines of the outputfile? I assume
>> defining an alternative command which does just that is not too
>> difficult, but sadly beyond me.
>
> It seems, that it's not possible at the moment. There is a tracker item
> for this feature: http://tracker.luatex.org/view.php?id=475

Not hard to do, just no interface. We can change buffers.range so that it
accepts {1,-4} to mean from first to last-4 lines, and then just set

\typefile[lines={1,-4}]{filename}

In any case, it is easy to define a lua function that does this.

\startluacode

function buffers.stripfromend(name, count)
if str and str~= "" then
local lines = str:splitlines()
local line, n, action = 0, 0, buffers.typeline
local first, last, m = buffers.strip(lines)
last = last - count
m    = m - count
for i=first,last do
n, line = action(lines[i], n, m, line)
end
end
end
\stopluacode

\unprotect
\def\strippedtyping#1#2% count file
{\begingroup
\tttf
\let\obs\specialobeyedspace
\ctxlua{buffers.stripfromend(\!!bs#2\!!es, #1)}
\endgraf
\endgroup}
\protect

\starttext

\strippedtyping{4}{filename}

\stoptext

To use this with t-filter, you can just say