[Techtalk] Question: sed s option in a shell script

Almut Behrens almut-behrens at gmx.net
Mon Mar 14 19:03:20 EST 2005


On Sun, Mar 13, 2005 at 08:41:30PM -0800, Sabine Konhaeuser wrote:
> 
> OLDSUFFIX=wav
> NEWSUFFIX=mp3
> for FILE in *."$OLDSUFFIX"
> do
>      NEWNAME=´"$FILE" | sed -e "s/$OLDSUFFIX/$NEWSUFFIX/"´
>      lame --preset standard "$FILE" "$NEWNAME"
> done

You're close to the solution...  Two things:

* you need an 'echo' in front of the wav-filename, so the name gets
piped through sed.  Without it, the shell would try to run the wav-file
anyname.wav as an executable (which of course doesn't work), piping its
output into sed.

* you need to use real backquotes: `...` (ASCII 96, not ASCII 180.
This may be a problem of writing/cut-n-pasting the code in some font
where you can't clearly see the difference, though.  In any case,
backquotes is probably what you meant... :)

Almut



More information about the Techtalk mailing list