Re: Unix command(s) to eliminate file extension?
Rodolfo Medina wrote:
>> Suppose I have in a directory a certain number of files,
>> all terminating with `.txt', and that I want to eliminate
>> that suffix from all of them.
>> Is there a Unix command, or perhaps a set of commands,
>> that can do so?
Roberto C. Sanchez wrote:
> rename 's/\.txt//' *.txt
Tim Ruehsen wrote:
> I might be a good idea to use
> rename 's/\.txt$//' *.txt
> (Just a detail).
Digby Tarvin wrote:
> If I correctly understand what you want to do, a simple
> minded way of doing it using two commands and a shell
> loop would be:
> for i in *.txt ;do
> mv $i `basename $i .txt`
> done
Thanks to all.
I adopted Roberto's and Tim's suggestion: it seems to work fine.
Cheers,
Rodolfo
Reply to: