Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- echo "Das ist das ultimative Menue"
- echo "mich gibt es nur weil bastelfreak wiedermal langeweile hat"
- while true
- do
- echo "----------------------------------------------------------------"
- echo "1. Datei runterladen und entpacken (sonst geht hier nix anderes)"
- echo "2. Ganzen Inhalt der Datei namen.txt ausgeben"
- echo "3. Die erste Zeile ausgeben"
- echo "4. Die letzte Zeile ausgeben"
- echo "5. Den Inhalt alphabetisch sortiert (A-Z) ausgeben"
- echo "6. Den Inhalt alphabetisch sortiert (Z-A) ausgeben"
- echo "Folgende Anzahl ausgeben:"
- echo " 7. Zeilenumbrueche"
- echo " 8. Woerter"
- echo " 9. Buchstaben"
- echo "10. Haeufigkeit des Names Thomas herausfinden"
- echo "11. Jede Person, die Thomas heist in einer Datei speichern"
- echo "----------------------------------------------------------------"
- echo "Usage:"
- echo " Immer die passende Nummer der Aufgabe angeben"
- echo " Programm wird mit dem Befehl Ende beendet"
- echo " Mit jeder beliebigen Taste geht das Script weiter"
- echo "----------------------------------------------------------------"
- read choice
- case "$choice" in
- 1) echo "url zur Datei?"
- read path
- wget "$path" -q -O data
- path2="$(tar xfvz data)"
- echo "Download und entpacken erfolgreich"
- read input
- echo ""
- echo ""
- ;;
- 2) cat $path2
- read input
- echo ""
- echo ""
- ;;
- 3) sed -n '1p' $path2
- read input
- echo ""
- echo ""
- ;;
- 4) tail -n 1 $path2
- read input
- echo ""
- echo ""
- ;;
- 5) sort $path2
- read input
- echo ""
- echo ""
- ;;
- 6) sort -r $path2
- read input
- echo ""
- echo ""
- ;;
- 7) IFS=" "
- test123="$(wc -l $path2)"
- set -- $test123
- echo $1
- read input
- echo ""
- echo ""
- ;;
- 8) IFS=" "
- test1234="$(wc -w $path2)"
- set -- $test1234
- echo $1
- read input
- echo ""
- echo ""
- ;;
- 9) IFS=" "
- test12345="$(wc -m $path2)"
- set -- $test12345
- echo $1
- read input
- echo ""
- echo ""
- ;;
- 10) cat $path2 | grep Thomas -c
- read input
- echo ""
- echo ""
- ;;
- 11) cat $path2 | grep Thomas > thomas.txt
- echo "Der Name Thomas wurde erfolgreich rausgegreppt und alle gematchten Eintraege in die thomas.txt geschrieben"
- read input
- echo ""
- echo ""
- ;;
- ende) echo "Linux ist Case sensitiv...";;
- Ende) echo "Byebye"; break;;
- esac
- done
Add Comment
Please, Sign In to add comment