Created
March 11, 2011 18:46
-
-
Save vvondra/866353 to your computer and use it in GitHub Desktop.
Tabulka ucasti
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# nactu si soubory s prezenci a ziskam unikatni seznam ucastniku | |
for f in $@ | |
do | |
cat $f >> tempprezencka | |
done | |
cat tempprezencka | sort | uniq > tempprezencka2 | |
rm -f tempprezencka | |
# nactu jmenu ucastniku do tempprezencka3 | |
getent passwd > passwdlist | |
while read line | |
do | |
grep $line passwdlist | cut -d: -f5 >> tempprezencka3 | |
done < tempprezencka2 | |
# spocitam ucast | |
for f in $@ | |
do | |
rm -f tempprezencka | |
# Projedu kazdy soubor s prezenci a na konci radku s uzivatelem pripsu, kolikrat jsem ho tam uz nasel | |
while read line | |
do | |
grep -c $line $f >> tempprezencka | |
done < tempprezencka2 | |
paste tempprezencka3 tempprezencka > tempprezencka4 | |
rm tempprezencka3 | |
mv tempprezencka4 tempprezencka3 | |
done | |
# vypis tabulky | |
cat tempprezencka3 | |
# uklid | |
rm tempprezencka tempprezencka2 tempprezencka3 passwdlist |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment