[CLUG-tech] how to replace in batch commands

Rainer M. Krug Rainer.Krug at uct.ac.za
Wed Mar 28 15:32:05 SAST 2007


Hi

I have to convert several files into a different format. This in itself 
is not a problem - I want to use the following script:

 > for i in `ls -1 *.shp`; do v.in.ogr dsn=$i 
output=HERE_IS_THE_PROBLEM; done

My problem is that I would have HERE_IS_THE_PROBLEM  be the file name 
without .shp.
My question: how can I cut the last four characters off $i to obtain 
only the file name (e.g. test from test.shp)?

Thanks for your help,

Rainer

-- 
NEW EMAIL ADDRESS AND ADDRESS:

Rainer.Krug at uct.ac.za

RKrug at sun.ac.za WILL BE DISCONTINUED END OF MARCH

Rainer M. Krug, Dipl. Phys. (Germany), MSc Conservation
Biology (UCT)

Leslie Hill Institute for Plant Conservation
University of Cape Town
Rondebosch 7701
South Africa

Fax:		+27 - (0)86 516 2782
Fax:		+27 - (0)21 650 2440 (w)
Cell:		+27 - (0)83 9479 042

Skype:		RMkrug

email:	Rainer.Krug at uct.ac.za
       	Rainer at krugs.de


More information about the clug-tech mailing list