Operating System - HP-UX
1848896 Members
5928 Online
104038 Solutions
New Discussion

Re: Renaming File in Specific Pattern

 
SOLVED
Go to solution
Fuad_1
Regular Advisor

Renaming File in Specific Pattern

Hi,

I have some files names starting with ERRF.XYZ, I want to move them to another directory with new names excluding the first 5 chars ERRF.. Can you help writing a script doing this stuff.
Set goals, and work to achieve them
2 REPLIES 2
Alan Turner
Regular Advisor
Solution

Re: Renaming File in Specific Pattern

cd directory_with_files

for i in ERRF.*
do
if [ -f "$i" ]
then
newname=${i#ERRF.}
/usr/bin/mv $i another_directory/$newname
fi
done
TSaliba
Trusted Contributor

Re: Renaming File in Specific Pattern

hi
you try also the script in the attached file
bye
jj