Remove the file extension
clemou01
-
zipe31 Posted messages 34620 Registration date Status Contributeur Last intervention -
zipe31 Posted messages 34620 Registration date Status Contributeur Last intervention -
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
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 réponses
Hi,
check out the -d option of tr, it might give you a clue...
--
A+ Blux
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"