I have a variable:
$FILENAME = /XXXX/XXXX/XXXX/file.dat
I want to set another variable that will give me this:
$FILENAME2=filea.dat
So basically i'm chopping up variable $FILENAME.
Not sure cut will do this as i'm looking at different directories so the characther length may be different e.g.
$FILENAME = /server1/test/data/file.dat
or
$FILENAME = /server17/dept_area/test/data/file.dat
What are the best way's to do this?