Advertisement
Guest User

Untitled

a guest
Mar 30th, 2020
100
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.45 KB | None | 0 0
  1. function saveToResultsFile {
  2. echo "$*" > wynik_bg.txt
  3. }
  4.  
  5. function addToResultsFile {
  6. echo "$*" >> wynik_bg.txt
  7. }
  8.  
  9. pattern="(?<=\(ev\):).*"
  10. i=1
  11. grep -ohP "$pattern" $1| while read -r line ; do
  12. stringarray=($line)
  13. homo=${stringarray[0]}
  14. lumo=${stringarray[1]}
  15. bg=`echo $lumo-$homo | bc -l`
  16. echo "$i: $bg"
  17. if [[ $i -eq 1 ]]; then
  18. saveToResultsFile "$i $bg"
  19. else
  20. addToResultsFile "$i $bg"
  21. fi
  22. i=$((i+1))
  23. done
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement