On Mon, Jan 05, 2004 at 07:09:45PM -0500, song wrote:
> Hi everybody,
> I would like to make this cool command of to zip some file. Let's say I have a 
> folder containing a.txt, a.zip, b.txt, b.zip, etc...
> I would like to add the text file to the zip file with the right name, 
> exemple: a.txt in a.zip; b.txt in b.zip; c.txt in c.zip; etc...
> I've tried grep function but with no succes. Right now, I do it manually, 
> like:
> zip a a.txt
> zip b b.txt
> zip c c.txt
> etc...
> Anybody could help me?

Not tested.

for i in *.txt
do
        zip `echo $i|sed s/\.txt/\.zip/` $i
done

Will work with files with spaces in the name if you quote $i's.

grep is for searching for occurences of a pattern in a file or output.


Todd

Want to buy your Pack or Services from MandrakeSoft? 
Go to http://www.mandrakestore.com

Reply via email to