Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 1 Sep 2023 12:28:22 +0200
From:      Michael Schuster <michaelsprivate@gmail.com>
To:        listac@nebelschwaden.de
Cc:        User Questions <questions@freebsd.org>
Subject:   Re: cut off last lines of a document
Message-ID:  <CADqw_gJhhBPR6HcSGQ-tg5M-XSXGXYMZFwLq_Y6OW1TNw7A3sw@mail.gmail.com>
In-Reply-To: <57be5495-97f8-4f22-9ae2-cd9712596e64@nebelschwaden.de>
References:  <57be5495-97f8-4f22-9ae2-cd9712596e64@nebelschwaden.de>

next in thread | previous in thread | raw e-mail | index | archive | help
--000000000000bcbc1f0604499ec5
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

On Fri, Sep 1, 2023 at 12:23=E2=80=AFPM Ede Wolf <listac@nebelschwaden.de> =
wrote:

> Hello,
>
>  From a file/output with an unknown amount of lines, I would like to
> filter out, or not display, the last 3 lines. Is there a way to archive
> this?
>
> For those also using linux, there is a "head -n -3" for this. That
> negative number option is not available on FreeBSD, but maybe there is
> an alterative way of doing this? Preferably /bin/sh compatible.
>

For a first go, I'd try a combination of "wc -l" and "head".
(don't have a BSD box up at the moment to check other utils)

HTH
Michael


> Thanks
>
> Ede
>
>

--=20
Michael Schuster
http://recursiveramblings.wordpress.com/
recursion, n: see 'recursion'

--000000000000bcbc1f0604499ec5
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr"><div dir=3D"ltr"><div class=3D"gmail_default" style=3D"fon=
t-family:arial,helvetica,sans-serif;font-size:small"><br></div></div><br><d=
iv class=3D"gmail_quote"><div dir=3D"ltr" class=3D"gmail_attr">On Fri, Sep =
1, 2023 at 12:23=E2=80=AFPM Ede Wolf &lt;<a href=3D"mailto:listac@nebelschw=
aden.de">listac@nebelschwaden.de</a>&gt; wrote:<br></div><blockquote class=
=3D"gmail_quote" style=3D"margin:0px 0px 0px 0.8ex;border-left:1px solid rg=
b(204,204,204);padding-left:1ex">Hello,<br>
<br>
=C2=A0From a file/output with an unknown amount of lines, I would like to <=
br>
filter out, or not display, the last 3 lines. Is there a way to archive <br=
>
this?<br>
<br>
For those also using linux, there is a &quot;head -n -3&quot; for this. Tha=
t <br>
negative number option is not available on FreeBSD, but maybe there is <br>
an alterative way of doing this? Preferably /bin/sh compatible.<br></blockq=
uote><div><br></div><div class=3D"gmail_default" style=3D"font-family:arial=
,helvetica,sans-serif;font-size:small">For a first go, I&#39;d try a combin=
ation of &quot;wc -l&quot; and &quot;head&quot;.</div><div class=3D"gmail_d=
efault" style=3D"font-family:arial,helvetica,sans-serif;font-size:small">(d=
on&#39;t have a BSD=C2=A0box up at the moment to check other utils)</div><d=
iv class=3D"gmail_default" style=3D"font-family:arial,helvetica,sans-serif;=
font-size:small"><br></div><div class=3D"gmail_default" style=3D"font-famil=
y:arial,helvetica,sans-serif;font-size:small">HTH</div><div class=3D"gmail_=
default" style=3D"font-family:arial,helvetica,sans-serif;font-size:small">M=
ichael</div><div class=3D"gmail_default" style=3D"font-family:arial,helveti=
ca,sans-serif;font-size:small"><br></div><blockquote class=3D"gmail_quote" =
style=3D"margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);pa=
dding-left:1ex">
<br>
Thanks<br>
<br>
Ede<br>
<br>
</blockquote></div><br clear=3D"all"><div><br></div><span class=3D"gmail_si=
gnature_prefix">-- </span><br><div dir=3D"ltr" class=3D"gmail_signature"><d=
iv dir=3D"ltr"><div>Michael Schuster<br><a href=3D"http://recursiverambling=
s.wordpress.com/" target=3D"_blank">http://recursiveramblings.wordpress.com=
/</a><br></div><div>recursion, n: see &#39;recursion&#39;<br></div></div></=
div></div>

--000000000000bcbc1f0604499ec5--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CADqw_gJhhBPR6HcSGQ-tg5M-XSXGXYMZFwLq_Y6OW1TNw7A3sw>