From owner-freebsd-questions Mon Sep 23 4:37:51 2002 Delivered-To: freebsd-questions@freebsd.org Received: from mx1.FreeBSD.org (mx1.FreeBSD.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 9DD3237B401 for ; Mon, 23 Sep 2002 04:37:50 -0700 (PDT) Received: from nic.upatras.gr (nic.upatras.gr [150.140.129.30]) by mx1.FreeBSD.org (Postfix) with SMTP id BEC9B43E81 for ; Mon, 23 Sep 2002 04:37:47 -0700 (PDT) (envelope-from keramida@ceid.upatras.gr) Received: (qmail 16376 invoked from network); 23 Sep 2002 11:30:33 -0000 Received: from upnet-dialinpool-95.upatras.gr (HELO hades.hell.gr) (150.140.128.159) by nic.upatras.gr with SMTP; 23 Sep 2002 11:30:33 -0000 Received: from hades.hell.gr (hades [127.0.0.1]) by hades.hell.gr (8.12.6/8.12.3) with ESMTP id g8NBb6mj000622; Mon, 23 Sep 2002 14:37:17 +0300 (EEST) (envelope-from keramida@ceid.upatras.gr) Received: (from keramida@localhost) by hades.hell.gr (8.12.6/8.12.3/Submit) id g8N9prXi014468; Mon, 23 Sep 2002 12:51:53 +0300 (EEST) (envelope-from keramida@ceid.upatras.gr) Date: Mon, 23 Sep 2002 12:51:53 +0300 From: Giorgos Keramidas To: Peter Leftwich Cc: freebsd-questions@FreeBSD.ORG Subject: Re: find case-insensitive challenge Message-ID: <20020923095153.GI1947@hades.hell.gr> References: <200209191353.g8JDrnlA057534@lurza.secnetix.de> <20020922214801.T68747-100000@earl-grey.cloud9.net> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20020922214801.T68747-100000@earl-grey.cloud9.net> X-PGP-Fingerprint: C1EB 0653 DB8B A557 3829 00F9 D60F 941A 3186 03B6 Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG On 2002-09-22 21:53, Peter Leftwich wrote: > You know, it's sad but in all my nine (9) years of grepping, I never once > used the "$" -- the "^" for "line beginning with" yes, but never the > immensely useful "$" in order to obtain the .xxx extensions :) > > That leads me to wonder about using "rev" to reverse the order of > characters on the line and "cut" using a field delimiter of "." :) :) You probably could, and then use rev to fix the lines back to their normal form too. rev | cut -d. -f2- | rev You can do that with sed(1) too, though: sed -e 's/\.[^.]*$//' Both of these should strip the `.xxx' extension of all input lines. Then, there's Perl, awk, and a few other tools. Practically unlimited ways of doing the same thing :) Giorgos. To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message