From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from lists.gentoo.org ([140.105.134.102] helo=robin.gentoo.org) by nuthatch.gentoo.org with esmtp (Exim 4.50) id 1EOnM4-0001WS-EB for garchives@archives.gentoo.org; Mon, 10 Oct 2005 02:25:32 +0000 Received: from robin.gentoo.org (localhost [127.0.0.1]) by robin.gentoo.org (8.13.5/8.13.5) with SMTP id j9A2EL4W025317; Mon, 10 Oct 2005 02:14:21 GMT Received: from outbound.mailhop.org (outbound.mailhop.org [63.208.196.171]) by robin.gentoo.org (8.13.5/8.13.5) with ESMTP id j9A29YOu013103 for ; Mon, 10 Oct 2005 02:09:34 GMT Received: from ip70-174-4-185.hr.hr.cox.net ([70.174.4.185] helo=phobos) by outbound.mailhop.org with esmtpsa (TLSv1:AES256-SHA:256) (Exim 4.51) id 1EOnFY-0006KA-8B for gentoo-user@lists.gentoo.org; Sun, 09 Oct 2005 22:18:48 -0400 Received: by phobos (Postfix, from userid 1000) id 2917613B4; Sun, 9 Oct 2005 22:18:59 -0400 (EDT) X-Mail-Handler: MailHop Outbound by DynDNS X-Originating-IP: 70.174.4.185 X-Report-Abuse-To: abuse@dyndns.com (see http://www.mailhop.org/outbound/abuse.html for abuse reporting information) X-MHO-User: jac299792458 Date: Sun, 9 Oct 2005 22:18:59 -0400 From: Jason Cooper To: gentoo-user@lists.gentoo.org Subject: Re: [gentoo-user] Simple command line stuff Message-ID: <20051010021859.GC14572@lakedaemon.net> References: <5bdc1c8b0510091906s2631d15bh46dc269fcb312534@mail.gmail.com> Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-user@gentoo.org Reply-to: gentoo-user@lists.gentoo.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <5bdc1c8b0510091906s2631d15bh46dc269fcb312534@mail.gmail.com> User-Agent: Mutt/1.5.8i X-Archives-Salt: ab174586-edc4-4db2-a615-c647556515a4 X-Archives-Hash: e8c6d308f18487cd61b300059f44260c Mark Knecht (markknecht@gmail.com) scribbled: > Hi, > I don't have a single book on Linux. (Amazing...) Can someone > recommend a simple book on command line stuff, or better yet a good > web site on this topic? Sorry, I picked up most of it from fiddling around, but on to your problem... > For instance, I wanted to run a specific command on every file in a > directory which will create a new file, so I need to do > > command file1.wav file1-convert.wav > > I need to take each name, create a new name to build the actual > command that gets run and then do that for every file in the > directory, or even in a hierarchy of directories. # for file in `ls *.wav` > do > newname=`echo ${file} | sed -e "s/\.wav$/-convert.wav/"` > command -i ${file} -o ${newname} > done chug...chug...chug and it's done. But this will only work on files in one subdirectory. For recursive operations, replace the first line with this: # for file in `find . -type f -iname "*.wav" -print` hth, jason. -- gentoo-user@gentoo.org mailing list