From owner-freebsd-questions Sun Sep 22 18:54: 2 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 105C637B401 for ; Sun, 22 Sep 2002 18:54:00 -0700 (PDT) Received: from russian-caravan.cloud9.net (russian-caravan.cloud9.net [168.100.1.4]) by mx1.FreeBSD.org (Postfix) with ESMTP id 5B51743E42 for ; Sun, 22 Sep 2002 18:54:00 -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 C1AE728ECC; Sun, 22 Sep 2002 21:53:58 -0400 (EDT) Date: Sun, 22 Sep 2002 21:53:58 -0400 (EDT) From: Peter Leftwich X-X-Sender: To: Oliver Fromme Cc: FreeBSD LIST Subject: Re: find case-insensitive challenge In-Reply-To: <200209191353.g8JDrnlA057534@lurza.secnetix.de> Message-ID: <20020922214801.T68747-100000@earl-grey.cloud9.net> Organization: Video2Video Services - http://Www.Video2Video.Com MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=iso-8859-1 Content-Transfer-Encoding: QUOTED-PRINTABLE 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 Thu, 19 Sep 2002, Oliver Fromme wrote: > Peter Leftwich 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