1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Shell convert to perl ?

Discussion in 'Perl' started by citiwang, Jun 2, 2011.

  1. citiwang

    citiwang New Member

    Joined:
    May 18, 2011
    Messages:
    3
    Likes Received:
    0
    Trophy Points:
    0
    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
     

Share This Page