I have shell scripting knowledge.
I have written a small shell script which will take a single argument.
with the help of that argument.
the file name format is axeA10_<date_time_stamp>_<sequence_number>.DAT
my script just takes all the files in the current directory and changes the sequence number.
so that i have the files with sequence numbers.
the need to write this script is that i dont have the files with the sequence number as some of the sequences are missing.
I know that perl can be more fast in doing this kind of tasks.And so i want to learn the same.
Can anyone convert this small shell script to perl.this would really boost my confidence in learning perl.Thanks in advance.Below is the script which works fine.
#!/bin/ksh
counter=1
for i in ${1}*.DAT
do
if [ $counter -lt 10 ]
then
new_name=`echo "$i"|awk -vcount=$counter 'BEGIN{FS="_";OFS="_"}{$3=count}{print $1"_"$2"_0"$3".DAT"}'`
else
new_name=`echo "$i"|awk -vcount=$counter 'BEGIN{FS="_";OFS="_"}{$3=count}{print $0".DAT"}'`
fi
mv $i $new_name
counter=$(($counter+1))
done
exit
“Can anyone convert this small shell script to perl.this would really boost my confidence in learning perl.”
How would someone doing this for you boost your confidence?
Visit the following URL
http://learn.perl.org/