Advertisement
Guest User

IS_AASO_S174012-S174120-S174085.sh

a guest
Mar 30th, 2020
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 0.57 KB | None | 0 0
  1. #Program włączać w formie ./<nazwa_programu.sh> <nazwa_pliku_z_danymi>
  2.  
  3. function saveToResultsFile {
  4.   echo "$*" > wynik_bg.txt
  5. }
  6.  
  7. function addToResultsFile {
  8.   echo "$*" >> wynik_bg.txt
  9. }
  10.  
  11. pattern="(?<=\(ev\):).*"
  12. i=1
  13. grep -ohP "$pattern" $1| while read -r line ; do
  14.   stringarray=($line)
  15.   homo=${stringarray[0]}
  16.   lumo=${stringarray[1]}
  17.   bg=`echo $lumo-$homo | bc -l`
  18.   echo "$i: $bg"
  19.   if [[ $i -eq 1 ]]; then
  20.     saveToResultsFile "$i $bg"
  21.   else
  22.     addToResultsFile "$i $bg"
  23.   fi
  24.   i=$((i+1))
  25. done
  26.  
  27. python3 ./IS_AASO_S174012-S174120-S174085.py
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement