Xavier Noria schreef:
> On Jan 23, 2007, at 9:55 AM, Dr.Ruud wrote:
>> [thread repaired] Saravana Kumar:
>>> I am trying to remove the extension from the a list of filenames
>>> and manipulate the names further.
>>>
>>> Tried to doing this:
>>> $file=~ s/\..*//;
>>>
>>> The above works fine. I get
Xavier Noria schreef:
>$file =~ s/\.\w+$//;
That solution is broken, think "file.txt~" and "file.$$$", etc.
:)
--
Affijn, Ruud
"Gewoon is een tijger."
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/
On Jan 23, 2007, at 9:55 AM, Dr.Ruud wrote:
Use an anchor and a negated character set:
s/\.[^.]*$//
That solution is broken, think "/foo/bar.baz/woo". Correct regexps
and other approaches have already been posted.
-- fxn
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional comm
Saravana Kumar schreef:
> I am trying to remove the extension from the a list of filenames and
> manipulate the names further.
>
> Tried to doing this:
> $file=~ s/\..*//;
>
> The above works fine. I get the result 'filename' if the filename is
> filename.ext.
>
> There are some files whose nam
Igor Sutton Lopes wrote:
>
> On 2007/01/23, at 11:03, Rob Dixon wrote:
>
>> $file =~ s/(.*)\./$1/;
>>
>> or
>>
>> $file =~ s/\.[^.]*$//;
>
> If you know the suffix of the files you're working on, you can use the
> File::Basename module, more specific the fileparse function:
>
> use File::Basen
On 2007/01/23, at 11:03, Rob Dixon wrote:
$file =~ s/(.*)\./$1/;
or
$file =~ s/\.[^.]*$//;
If you know the suffix of the files you're working on, you can use
the File::Basename module, more specific the fileparse function:
use File::Basename;
my @suffix = qw(.txt .zip .doc);
my $filep
Saravana Kumar wrote:
>
shaick mohamed wrote:
On 1/23/07, Saravana Kumar <[EMAIL PROTECTED]> wrote:
I am trying to remove the extension from the a list of filenames and
manipulate the names further.
Tried to doing this:
$file=~ s/\..*//;
The above works fine. I get the result 'filename' if
On Jan 23, 2007, at 8:22 AM, Saravana Kumar wrote:
Hi list,
I am trying to remove the extension from the a list of filenames and
manipulate the names further.
Tried to doing this:
$file=~ s/\..*//;
The above works fine. I get the result 'filename' if the filename is
filename.ext.
There are s
shaick mohamed wrote:
> Try this
> s/(.*)\..*/\1/;
>
> Thanks,
> Shaick.
>
> On 1/23/07, Saravana Kumar <[EMAIL PROTECTED]> wrote:
>> Hi list,
>>
>> I am trying to remove the extension from the a list of filenames and
>> manipulate the names further.
>>
>> Tried to doing this:
>> $file=~ s/\..*/
Try this
s/(.*)\..*/\1/;
Thanks,
Shaick.
On 1/23/07, Saravana Kumar <[EMAIL PROTECTED]> wrote:
Hi list,
I am trying to remove the extension from the a list of filenames and
manipulate the names further.
Tried to doing this:
$file=~ s/\..*//;
The above works fine. I get the result 'filename'
Hi list,
I am trying to remove the extension from the a list of filenames and
manipulate the names further.
Tried to doing this:
$file=~ s/\..*//;
The above works fine. I get the result 'filename' if the filename is
filename.ext.
There are some files whose names are like file.name.ext and the
11 matches
Mail list logo