Link to home
Start Free TrialLog in
Avatar of Tolgar
Tolgar

asked on

How can I get the word after the last slash of a string and remove the dots if there is any?

How can I get the word after the last slash of a string and remove the dots if there is any?

Example input:

S:/some/path/to/file.x

Open in new window


Expected output:

file

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of shishir_sri
shishir_sri
Flag of India image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of ozo
If you want a Perl answer, since that's where this question was posted:

perl -MFile::Basename -le "print scalar fileparse shift,qr/\..*/" S:/some/path/to/file.x
Avatar of Tolgar
Tolgar

ASKER

Thanks Ozo