perl one liner to remove all but the base file name



If I have a file name like:

/dkdk888/jdty/file.txt

how can I get to just 'file' using a regex. I have come up with
or
/dkdk/dkdue/dfdf.txt.1234

and ending up with 'dfdf'

I have come up with 's/^.*\/\([^/]*\)$/\1/' but cannot get rid of the
extension. Also I have thought about using basename with the suffix but the
suffix can be different.

Thanks


.



Relevant Pages

  • Re: perl one liner to remove all but the base file name
    ... Oxnard wrote on MMMMCMIII September MCMXCIII in ... && how can I get to just 'file' using a regex. ... Also I have thought about using basename with the suffix but the ...
    (comp.lang.perl.misc)
  • Re: Force POSIX NFA in Perl?
    ... It could be done by putting something like '$' at the end of a regex. ... my $suffix = qr//; ... local our @substrings; ...
    (comp.lang.perl.misc)
  • Re: perl one liner to remove all but the base file name
    ... && how can I get to just 'file' using a regex. ... Also I have thought about using basename with the suffix ... I cannot find a reference to it. ...
    (comp.lang.perl.misc)
  • Re: [opensuse] OpenOffice default question
    ... Are you talking about on Windows machines? ... taking over the .doc extension normally used by Word. ... digit suffix and assign the OO word type of application to that ... You’d then need to change the suffixes on any OO word type ...
    (SuSE)
  • Re: Need Help with Program in Perl on a Netware Server
    ... There is only one folder to look in. ... I have no idea how to go about doing this in perl. ... split it to get the basename and suffix ... If not, add it, with a value of the suffix. ...
    (comp.lang.perl.misc)