daily pastebin goal
57%
SHARE
TWEET

Untitled

a guest Mar 19th, 2019 54 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. ./script.sh niubXXXXXX problems A00
  2.      
  3. #!/bin/bash
  4.  
  5. if [ ! $# -eq 3 ]
  6. then
  7.     echo "Falta argument. Usage: ./script5.sh directori "
  8.     exit 1
  9. fi
  10. alumne=$1
  11. columna=$2
  12. grupCanvi=$3
  13.  
  14. if [ "$columna" = "problemes" ]
  15. then
  16.     awk -F';' -v OFS=';' -v id=$alumne -v new_group=$grupCanvi
  17. '{if($1==id)$3=new_group}1' ./alumnes.csv > ./alumnes.csv
  18.  
  19.     echo "Grup de problemes modificat"
  20. fi
  21.  
  22. if [ "$columna" = "practiques" ]
  23. then
  24.     awk -F';' -v OFS=';' -v id=$alumne -v new_group=$grupCanvi
  25. '{if($1==id)$2=new_group}1' ./alumnes.csv > ./alumnes.csv
  26.  
  27.     echo "Grup de pràctiques modificat"
  28. fi
  29.      
  30. awk -F';' -v OFS=';' -v id=$alumne -v new_group=$grupCanvi
  31. '{if($1==id)$2=new_group}1' ./alumnes.csv >> ./alumnes.csv
  32.      
  33. IUB;Grup Pràctiques;Grup Problemes
  34. niubXXXXXXXX;B00;CF0
  35. niubXXXXXXXX;A00;CF0
  36. niubXXXXXXXX;C00;CF0
  37. niubXXXXXXXX;F00;AB0
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
 
Top