From nobody Sun Sep 03 13:06:12 2023 X-Original-To: questions@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4RdsTs2mDlz4rM8f for ; Sun, 3 Sep 2023 13:06:25 +0000 (UTC) (envelope-from freebsd@edvax.de) Received: from mout.kundenserver.de (mout.kundenserver.de [212.227.126.131]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "mout.kundenserver.de", Issuer "Telekom Security ServerID OV Class 2 CA" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4RdsTr5G3Vz3Tvs for ; Sun, 3 Sep 2023 13:06:24 +0000 (UTC) (envelope-from freebsd@edvax.de) Authentication-Results: mx1.freebsd.org; none Received: from terra.edvax.de ([178.12.38.24]) by mrelayeu.kundenserver.de (mreue009 [213.165.67.97]) with ESMTPSA (Nemesis) id 1Mnac9-1ptrDP0r3N-00jdMx; Sun, 03 Sep 2023 15:06:22 +0200 Received: from r56.edvax.de (r56 [10.200.1.11]) (authenticated bits=0) by terra.edvax.de (8.17.1/8.17.1) with ESMTPA id 383D6H3N046475; Sun, 3 Sep 2023 15:06:17 +0200 (CEST) (envelope-from freebsd@edvax.de) Date: Sun, 3 Sep 2023 15:06:12 +0200 From: Polytropon To: listac@nebelschwaden.de Cc: questions@freebsd.org Subject: Re: cut off last lines of a document Message-Id: <20230903150612.c88185f3.freebsd@edvax.de> In-Reply-To: References: <57be5495-97f8-4f22-9ae2-cd9712596e64@nebelschwaden.de> Reply-To: Polytropon Organization: EDVAX X-Mailer: Sylpheed 3.1.1 (GTK+ 2.24.5; i386-portbld-freebsd8.2) List-Id: User questions List-Archive: https://lists.freebsd.org/archives/freebsd-questions List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-freebsd-questions@freebsd.org X-BeenThere: freebsd-questions@freebsd.org Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Provags-ID: V03:K1:3KXGbtMpZPJUcoxBt8bUtlzcS8eg/8fsBzs4vj0ukMmIr5JD+SF 0Oit2B5oygKJgkCEsxalBS3IJmN43M5uvl09M+HtlNHE9ef4E5AksVaRSbn5Vcm5P70ffGd GB4mEg6HZxQsBQuY59mp1vgSMkLMtdxLtSx1900Pf+vUkjXNnrzoqPO4HshOcrLjflaIsnA dYr9DIR5GDyCi70e4v19w== X-Spam-Flag: NO UI-OutboundReport: notjunk:1;M01:P0:wJu0eQQFbfM=;StQ33w8FXF5/pOtXBPQj03tQ0uf MjrM4yr7SzUtZjshKbg24q39eZsTQBFhE4iteBylzTYad6rnSphPUH4v+dSdIXHRQ90Xg4Bhc QtZSVoAExKfMM6DVZO7IjwgJUH/zGCOPjZuFHcIYQieUDkb3qbO/txTXdVOqu0YWMjmqvWEXO O3W0XHWs3GOipctuzTWGfkKE5aGEHsfTLrfuZXPc+ogsTucLq2nqidJUqlXgApFNlY8aGjxd5 KyxYt7BsMeYGiCBIQRPh5zEPwpdsNELse8aGZjVii8OTheleshYRjLmfIKlf70+kinJ0DDp2Q +kiONUdJxMz+65wxa7vM4eavnvMMZCQkVlSsxCPSznp7dPSQqu5hu8gtGRi05fVBM1FWdTcC3 vLtOfOCmMzv7msG54JvQIUGMJoFsUAzXgmo2rF4k+W6CDbDl1q0e+4rWPAn73OjQg9mg/ZTFE tvVScJtfovqNNIXNytg6+LHlWCzeEHkRTrbNW1vacczwHPOHs0WEGBHZIZr+BNSEyL4HqL+PT AROQeTbtK5pJP6bIDjqJ/wF9UtdbBxIXfCa5KvDQbmzRkVZBgMCltO4J0iiTboAT1j1+Uznr/ tE/mcZtvsrwHUAPFKYU9xqi42uxg0R0XGbaqtNpUuWM+KfemTivro+0H7kSWVcrFUcHCQEuyy WagMvSPUPy+QZikg8Tgy8MLlEivAagVdMQvKVeeL+I9nuAurrxWordVjQqH4SSy2oHideyWvA gAP8v/Znuy6W9VWeAm+/MK1xkvJ/dAyA2XQAMEPfxjPcDp04b4cqxnyKKDGZOTGctiMT92gRM eIhMoNOGVOnmhvWHKvyGaqAn0M2JsZnr1rAZ7DZrePXssF4Bz1fqpnfIHp0z4E5BzQSeg90vp kW0q4RdW9+qUdHQ== X-Spamd-Bar: ---- X-Rspamd-Pre-Result: action=no action; module=replies; Message is reply to one we originated X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[]; ASN(0.00)[asn:8560, ipnet:212.227.0.0/16, country:DE] X-Rspamd-Queue-Id: 4RdsTr5G3Vz3Tvs On Sun, 3 Sep 2023 10:05:46 +0200, Ede Wolf wrote: > Am 02.09.23 um 05:37 schrieb lain.: > > On 2023年09月01日 11:37, the silly Ede Wolf claimed to have said: > >> as it again is specific to FreeBSD, so if there is a > >> more universal solution, that would be preferred. Even though this of course > >> is a FreeBSD mailing list. > > > > I should point out that FreeBSD coreutils are not GNU coreutils, so > > there are going to be differences. > > And there are 1000s of different versions of coreutils available, > > because they're so easy to re-create, and each one of them work > > differently. > > > > I am aware of this, that is why I am so thankfull for the sed and awk > solutions provided here. Those are a little bit more handy than a perl > script :) > > Of course there are differences between those tools as well, but so far > those seem to have a common playground - the awk as well as sed examples > so far are working for gnu as well as [Free|Net]BSD. Not even required > to add the --posix flag to gnu sed. If I may: Everything depends. If your goal is maximum portability, you absolutely need to stay away from GNU extensions. So if your script needs to run on various Linux and UNIX (!) systems, only using the most common tools in their most simple versions is the way to go. In such cases, your script might not be the most optimum one, it might even be a bit inefficient, but in the end, it will run everywhere. It will even run on systems where you are not allowed to (or not able to) install things you might need, such as GNU tools. Assuming that the most recent tools of one Linux distribution are available on all other Linusi as well as on different UNIXes, and intending to use the most modern and fashionable technologies will not cover the specific cases of "other UNIX" you might run into. But in case you can fully control your target environment, there is absolutely nothing wrong in using state-of-the-art script languages if they are available to you (or can easily be made available by simply installing them). Yes, I am old. And stupid. Says the guy who writes stuff in sh, grep, sed, awk, cut, paste and other old-fashioned languages because it _needs_ to run everywhere... ;-) -- Polytropon Magdeburg, Germany Happy FreeBSD user since 4.0 Andra moi ennepe, Mousa, ...