SHARE
TWEET

Untitled

a guest Oct 21st, 2019 75 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. ppid=0
  2. sleepavg=0
  3. count=0
  4. b=""
  5. while read a
  6. do
  7.     if [[ -n $a ]]
  8.     then
  9.         newppid=$(echo $a | grep -E -h -s -i -o "Parent_ProcessID=[0-9]+" | grep -o "[0-9]\+")
  10.         newsleepavg=$(echo $a | grep -E -h -s -i -o "Average_Sleeping_Time=[0-9.]+" | grep -o "[0-9.]\+" | awk '{printf("%s",$1)}')
  11.         if [[ $ppid == $newppid ]]
  12.         then
  13.             sleepavg=$(echo "$sleepavg+$newsleepavg" | bc -l -q)
  14.             count=$(echo "$count+1" | bc -l -q)
  15.         else
  16.             sleepavg=$(echo "$sleepavg/$count" | bc -l -q)
  17.             if [[ -n $b ]]
  18.             then
  19.                 b=$b"Average_Sleeping_Children_of_ParentID="$ppid" is "$sleepavg$'\n'
  20.             fi
  21.             sleepavg=$newsleepavg
  22.             ppid=$newppid
  23.             count=1
  24.         fi
  25.         b=$b$a$'\n'
  26.     fi
  27.     done < ans5.tmp
  28.     sleepavg=$(echo "$sleepavg/$count" | bc -l -q)
  29. if [[ -n $b ]]
  30. then
  31.     b=$b"Average_Sleeping_Children_of_ParentID="$ppid" is "$sleepavg$'\n'
  32. fi
  33. echo "$b" > ans6.tmp
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top