HI
I have 100 files in below folder:-
/home/lkj/TEST
File name like below
undo_ARL01003_120907-155022.mos
undo_ARL01006_120908-155042.mos
i want replace one first line of each file to pt all
i want change file name as below.
ARL01003.mos
ARL01006.mos
Thanks
Hi,
may be this help you:
That's rather a roundabout way of doing it... See Useless Use of Backticks.
OLDIFS="$IFS"
IFS="-_."
ls | while read A B C D EXT
do
echo mv "${A}_${B}_${C}-${D}.${EXT}" "${B}.${EXT}"
done
IFS="$OLDIFS"
Remove the echo once you've tested it and are sure it does what you want.
1 Like