Go4Expert

Go4Expert (http://www.go4expert.com/)
-   Perl (http://www.go4expert.com/forums/perl/)
-   -   Shell convert to perl ? (http://www.go4expert.com/forums/shell-convert-perl-t25968/)

citiwang 2Jun2011 14:06

Shell convert to perl ?
 
I have done a script, but it is based on shell script, and i want to convert it to perl. I am very new to perl.

#!/bin/bash
echo $b
echo $fileday
echo $datatype
# Count Daily Total History:
for i in $datatype
do
gzcat $addToPath/PM.$b.$fileday.*.xml.gz |grep $i >> $addToPath/$i.log
done

# Summation Daily Total Counts:
for i in $datatype
do
total=0
number=0
filename=$addToPath/$i.log
while read line
do
number=` echo $line | cut -d '>' -f2 | cut -d '<' -f1 `
let total+=number
done < $filename
echo " the $i total sum = $total" >> $addToPath/$result_file
cat $addToPath/$result_file
done


All times are GMT +5.5. The time now is 07:58.