Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 23 Sep 2002 12:51:53 +0300
From:      Giorgos Keramidas <keramida@ceid.upatras.gr>
To:        Peter Leftwich <Hostmaster@Video2Video.Com>
Cc:        freebsd-questions@FreeBSD.ORG
Subject:   Re: find case-insensitive challenge
Message-ID:  <20020923095153.GI1947@hades.hell.gr>
In-Reply-To: <20020922214801.T68747-100000@earl-grey.cloud9.net>
References:  <200209191353.g8JDrnlA057534@lurza.secnetix.de> <20020922214801.T68747-100000@earl-grey.cloud9.net>

next in thread | previous in thread | raw e-mail | index | archive | help
On 2002-09-22 21:53, Peter Leftwich <Hostmaster@Video2Video.Com> 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




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