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
[-- Attachment #1 --] On Fri, Sep 1, 2023 at 12:23 PM 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 > > -- Michael Schuster http://recursiveramblings.wordpress.com/ recursion, n: see 'recursion' [-- Attachment #2 --] <div dir="ltr"><div dir="ltr"><div class="gmail_default" style="font-family:arial,helvetica,sans-serif;font-size:small"><br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Fri, Sep 1, 2023 at 12:23 PM Ede Wolf <<a href="mailto:listac@nebelschwaden.de">listac@nebelschwaden.de</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Hello,<br> <br> From 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 "head -n -3" for this. That <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></blockquote><div><br></div><div class="gmail_default" style="font-family:arial,helvetica,sans-serif;font-size:small">For a first go, I'd try a combination of "wc -l" and "head".</div><div class="gmail_default" style="font-family:arial,helvetica,sans-serif;font-size:small">(don't have a BSD box up at the moment to check other utils)</div><div class="gmail_default" style="font-family:arial,helvetica,sans-serif;font-size:small"><br></div><div class="gmail_default" style="font-family:arial,helvetica,sans-serif;font-size:small">HTH</div><div class="gmail_default" style="font-family:arial,helvetica,sans-serif;font-size:small">Michael</div><div class="gmail_default" style="font-family:arial,helvetica,sans-serif;font-size:small"><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"> <br> Thanks<br> <br> Ede<br> <br> </blockquote></div><br clear="all"><div><br></div><span class="gmail_signature_prefix">-- </span><br><div dir="ltr" class="gmail_signature"><div dir="ltr"><div>Michael Schuster<br><a href="http://recursiveramblings.wordpress.com/" target="_blank">http://recursiveramblings.wordpress.com/</a><br></div><div>recursion, n: see 'recursion'<br></div></div></div></div>
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CADqw_gJhhBPR6HcSGQ-tg5M-XSXGXYMZFwLq_Y6OW1TNw7A3sw>
