Gentoo Archives: gentoo-user

From: Jason Cooper <gentoo@××××××××××.net>
To: gentoo-user@l.g.o
Subject: Re: [gentoo-user] Simple command line stuff
Date: Mon, 10 Oct 2005 02:25:32
Message-Id: 20051010021859.GC14572@lakedaemon.net
In Reply to: [gentoo-user] Simple command line stuff by Mark Knecht
1 Mark Knecht (markknecht@×××××.com) scribbled:
2 > Hi,
3 > I don't have a single book on Linux. (Amazing...) Can someone
4 > recommend a simple book on command line stuff, or better yet a good
5 > web site on this topic?
6
7 Sorry, I picked up most of it from fiddling around, but on to your
8 problem...
9
10 > For instance, I wanted to run a specific command on every file in a
11 > directory which will create a new file, so I need to do
12 >
13 > command file1.wav file1-convert.wav
14 >
15 > I need to take each name, create a new name to build the actual
16 > command that gets run and then do that for every file in the
17 > directory, or even in a hierarchy of directories.
18
19
20 # for file in `ls *.wav`
21 > do
22 > newname=`echo ${file} | sed -e "s/\.wav$/-convert.wav/"`
23 > command -i ${file} -o ${newname}
24 > done
25
26 chug...chug...chug
27
28 and it's done. But this will only work on files in one subdirectory.
29 For recursive operations, replace the first line with this:
30
31 # for file in `find . -type f -iname "*.wav" -print`
32
33 hth,
34
35 jason.
36 --
37 gentoo-user@g.o mailing list