Date: Sun, 22 Sep 2002 21:53:58 -0400 (EDT) From: Peter Leftwich <Hostmaster@Video2Video.Com> To: Oliver Fromme <olli@secnetix.de> Cc: FreeBSD LIST <freebsd-questions@FreeBSD.ORG> Subject: Re: find case-insensitive challenge Message-ID: <20020922214801.T68747-100000@earl-grey.cloud9.net> In-Reply-To: <200209191353.g8JDrnlA057534@lurza.secnetix.de>
next in thread | previous in thread | raw e-mail | index | archive | help
On Thu, 19 Sep 2002, Oliver Fromme wrote:
> Peter Leftwich <Hostmaster@video2video.com> wrote:
> > Tonight I surprised myself by running `find ~/Desktop/folder/ -name "*=
=2Ejpg"
> > -exec mv {} ~/Desktop/folderjpgs/ \;` successfully! My first custom f=
ind
> > command line ever.
> In general, it is a good idea to try to avoid -exec, because
> it is inefficient. -exec runs the specified command for every
> single file, whilch can be terribly slow if there are a lot of
> files. Better use xargs instead, which will collect multiple
> filenames and execute the command fewer times.
This and the other posts using "xargs" were awe-inspiring!!
> This also enables you to use grep to filter the file names in
> a more sophisticated way than find itself can do:
> find foo -type f | grep -i '\.jpg$' | xargs -J % mv % bar
> Regards
> Oliver
Amazing, I just wanted to post and say "Have I told you (all) lately, that
I love you?" This is the most incredible learning experience, and I must
say that my command-line skills just grew approximately 14555% fold :)
Out with the old (`ls -alR | grep -i whatever`) and in with the new, which
does `[find items that are of the type "file," grep case-insensitively for
ones that end in a period then j, p, then g at the end of the line...` now
xargs I am going to have practice because I don't quite fully get it yet.
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 "." :) :)
Thanks again everyone on this thread!
> Oliver Fromme, secnetix GmbH & Co KG, Oettingenstr. 2, 80538 M=FCnchen
> "All that we see or seem is just a dream within a dream" (E. A. Poe)
--
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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20020922214801.T68747-100000>
