dayankoven
Programmer
Hi there fellow experts,
I'm trying to replace a filename from a working directory to a a new filename. The problem that i face is that 2 of the files share the almost the same filename. Both these files will reside at the same time in the same directory;
/home/working
For eg :-
File A = LOAN_APPL20031209122345
File B = LOAN_APPL_STATUS20031109122355
I need to rename File A to become 110020031209122345
and File B to become 120020031109122355.
The script that i have is as following :-
for file in $1*
do
echo ${file#$1$3}
mv "${file}" "$2${file#$1$3}"
done
$1 is the parameter passed in which would be LOAN_APPL for File A and LOAN_APPL_STATUS for File B.
The problem is that since it is $1*, file B is also getting renamed when it reality it should not be. Could someone please help show how i can rename only file A and leave file B intact.
Thanks in advance to all the experts.
I'm trying to replace a filename from a working directory to a a new filename. The problem that i face is that 2 of the files share the almost the same filename. Both these files will reside at the same time in the same directory;
/home/working
For eg :-
File A = LOAN_APPL20031209122345
File B = LOAN_APPL_STATUS20031109122355
I need to rename File A to become 110020031209122345
and File B to become 120020031109122355.
The script that i have is as following :-
for file in $1*
do
echo ${file#$1$3}
mv "${file}" "$2${file#$1$3}"
done
$1 is the parameter passed in which would be LOAN_APPL for File A and LOAN_APPL_STATUS for File B.
The problem is that since it is $1*, file B is also getting renamed when it reality it should not be. Could someone please help show how i can rename only file A and leave file B intact.
Thanks in advance to all the experts.