Skip to content

Instantly share code, notes, and snippets.

@vvondra
Created March 11, 2011 18:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save vvondra/866353 to your computer and use it in GitHub Desktop.
Save vvondra/866353 to your computer and use it in GitHub Desktop.
Tabulka ucasti
# 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