Re: perl one liner to remove all but the base file name




"Abigail" <abigail@xxxxxxxxxx> wrote in message
news:slrnes536r.ekq.abigail@xxxxxxxxxxxxxxxxxxxxxxx
Oxnard (oxnard@xxxxxxxxxxxxxxx) wrote on MMMMCMIII September MCMXCIII in
<URL:news:45c28416$0$16668$4c368faf@xxxxxxxxxxxxxx>:
&& 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.


s !.*/!!; s !\.[^.]+$!!;


Abigail
--
perl5.004 -wMMath::BigInt -e'$^V=Math::BigInt->new(qq]$^F$^W783$[$%9889$^F47]
.qq]$|88768$^W596577669$%$^W5$^F3364$[$^W$^F$|838747$[8889739$%$|$^F673$%$^W]
.qq]98$^F76777$=56]);$^U=substr($]=>$|=>5)*(q.25..($^W=@^V))=>do{print+chr$^V
%$^U;$^V/=$^U}while$^V!=$^W'


What does the !! do ... I cannot find a reference to it.


.



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)
  • perl one liner to remove all but the base file name
    ... how can I get to just 'file' using a regex. ... extension. ... Also I have thought about using basename with the suffix but the ...
    (comp.lang.perl.misc)
  • 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)
  • Re: Delphi Dot Net, Better than Win32, or just Hype?
    ... I use the "Ref" suffix for anything that passes a reference to an object that shouldn't be freed. ... I find that I normally work with one primary structure that contains all the objects and then I have other objects that simply reference the contained objects. ...
    (borland.public.delphi.non-technical)