Advertisement
Guest User

Untitled

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