Re: perl one liner to remove all but the base file name
- From: Abigail <abigail@xxxxxxxxxx>
- Date: 02 Feb 2007 00:59:19 GMT
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'
.
- Follow-Ups:
- References:
- perl one liner to remove all but the base file name
- From: Oxnard
- perl one liner to remove all but the base file name
- Prev by Date: Re: perl one liner to remove all but the base file name
- Next by Date: Re: Read on closed filehandle
- Previous by thread: Re: perl one liner to remove all but the base file name
- Next by thread: Re: perl one liner to remove all but the base file name
- Index(es):
Relevant Pages
|