From owner-freebsd-questions Mon Sep 23 19:24:19 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 B560937B401 for ; Mon, 23 Sep 2002 19:24:17 -0700 (PDT) Received: from russian-caravan.cloud9.net (russian-caravan.cloud9.net [168.100.1.4]) by mx1.FreeBSD.org (Postfix) with ESMTP id 5E88E43E3B for ; Mon, 23 Sep 2002 19:24:17 -0700 (PDT) (envelope-from Hostmaster@Video2Video.Com) Received: from earl-grey.cloud9.net (earl-grey.cloud9.net [168.100.1.1]) by russian-caravan.cloud9.net (Postfix) with ESMTP id 0B81C28BE3; Mon, 23 Sep 2002 22:24:17 -0400 (EDT) Date: Mon, 23 Sep 2002 22:24:17 -0400 (EDT) From: Peter Leftwich X-X-Sender: To: Giorgos Keramidas Cc: FreeBSD LIST Subject: Re: find case-insensitive challenge [cut/sed] In-Reply-To: <20020923095153.GI1947@hades.hell.gr> Message-ID: <20020923221952.A20965-100000@earl-grey.cloud9.net> Organization: Video2Video Services - http://Www.Video2Video.Com MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII 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 Mon, 23 Sep 2002, Giorgos Keramidas wrote: > On 2002-09-22 21:53, Peter Leftwich wrote: > > 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` I definitely favor "cut." How common across the various Unices/Unixes is cut, that is, does Sun/Solaris or Linux come with cut included? > You can do that with sed(1) too, though: `sed -e 's/\.[^.]*$//'` Can you say in poor-man's terms what the above line does? I used to use `sed -e 's/this/that/g'` often but haven't for a few years now. The way I would remember the command was "sed edit substitute this for that _g_ood we're done" even though I am aware the g is for global. > 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. I wonder if there is a book just chock full of sed, awk, cut, and perl examples dissected into layman's terms... :) Maybe an ORA.COM book? -- Peter Leftwich President & Founder Video2Video Services Box 13692, La Jolla, CA, 92039 USA +1-413-403-9555 To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message