Remove the file extension

Hello,

I am currently looking to remove the extension from a file in shell. In fact, we were asked to truncate the names of the files at the extension level so that only the name is displayed (without the .blah). We were also told to use the tr function to do this.

Does anyone have an idea?

Here is my script:

#!/bin/bash

cd /home/Audit

for auditor in *

do
cd $auditor
pwd
ls

for files in *
do
report='echo $files|tr "." " "'
echo $report

done
cd ..
done

Configuration: Linux / Firefox 3.6.12

3 answers

  • Votes
  • Date
  • Descending date
  1. Moderator
    Hi,

    check out the -d option of tr, it might give you a clue...

    --
    A+ Blux
     "Stupid people dare everything. That's even how we recognize them" 
    1. After my research, all the possibilities I tried did not work.
      1. Contributor
        Hi,

        I admit I've also explored many possibilities with "tr" without success ,-((

        Is it really the sine qua non condition (tr) to achieve this?

        The expansion of braces seems very appropriate for this kind of thing...
        ;-\
        --
        Zen my nuggets ;-)