that will work in 6.x and above.  i'm sure most posters out there have that,
though.

-----Original Message-----
From: Eric Augenstein [mailto:eric@;es-geo.com] 
Sent: Wednesday, October 30, 2002 11:58 AM
To: [EMAIL PROTECTED]
Subject: Re: i only want the file name!


At 11:47 AM 10/30/2002 -0500, you wrote:
>how can i get ONLY the file name from a variable?
>example:
>$var = "F:\Trends_Analysis\data\data_creation\batchtest\emp805575.jpg"
>all i want is "emp805575" with NO EXTENSTION.

Use the "filename" command to get the name of the file itself, then split
the filename at the period and use the first part, i.e.,

$var = "F:\Trends_Analysis\data\data_creation\batchtest\emp805575.jpg"
$fname = filename $var # returns "emp805575.jpg"
$fname_sp = split $fname at "." # split name at dot $fname_no_ext =
$fname_sp[1] # set var to part 1 "emp805575"

If you have multiple dots in the filename (i.e., file1.10m.jpg) then you'll
need to do a bit more work.

Eric Augenstein
---------------------------------------------------------------
Earthstar Geographics
5330 Carroll Canyon Road
Suite 206
San Diego, CA 92121 USA

Email: [EMAIL PROTECTED]
Web: www.es-geo.com
Tel: +1 858-455-9970
Fax: +1 858-455-9971
---------------------------------------------------------------



-----------------------------------------------------------

To make changes to your subscription, please visit our website,
http://www.ermapper.com/technicl/ermapperl/index.htm
-----------------------------------------------------------

To make changes to your subscription, please visit our website, 
http://www.ermapper.com/technicl/ermapperl/index.htm

Reply via email to