[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: bash/sed script help needed



On Wed, 2002-07-03 at 11:36, Lance Hoffmeyer wrote:
> I have ten files in a directory I am trying to convert from *.eps to *.jpg.
> 
> file1.eps
> file2.eps
> file3.eps
> 
> 
> for a in *.eps;do t=`sed 's/*.eps/*.jpg/'`;convert $a $t;done
> 
> But this doesn't rename the file to file1.jpg
> 
> Why?

Because the sed s/// operator uses regular epressions not globbing.
*.jpg is an example of a globbing pattern. ".*\.jpg" is the same
expressed as a regular epression. Try

s/eps/jpg/

instead.

The other thing is what is sed actually working on? Sed will be getting
nothing. Use

t=`echo $a | sed 's/eps/jpg/'`

All this is not tested, just of the top of my head, so YMMV.

Kind Regards
Crispin Wellington


-- 
To UNSUBSCRIBE, email to debian-user-request@lists.debian.org 
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org



Reply to: