diff options
author | lonkaars <loek@pipeframe.xyz> | 2023-03-05 17:49:21 +0100 |
---|---|---|
committer | lonkaars <loek@pipeframe.xyz> | 2023-03-05 17:49:21 +0100 |
commit | 2798a8145fa7c349ac45b688ab346add765ace32 (patch) | |
tree | 3f4d599d7cc36312dc3a2ffc40acb7b6988e72e7 /os1w4 | |
parent | db39bc7df6927dd81ccbe32dc5a247e619b58f86 (diff) |
os week 4 klaar
Diffstat (limited to 'os1w4')
-rw-r--r-- | os1w4/.gitignore | 3 | ||||
-rwxr-xr-x | os1w4/lotto | 2 | ||||
-rw-r--r-- | os1w4/practicum.md | 95 |
3 files changed, 100 insertions, 0 deletions
diff --git a/os1w4/.gitignore b/os1w4/.gitignore new file mode 100644 index 0000000..17126be --- /dev/null +++ b/os1w4/.gitignore @@ -0,0 +1,3 @@ +index.html +data.csv +lines.txt diff --git a/os1w4/lotto b/os1w4/lotto new file mode 100755 index 0000000..74c6457 --- /dev/null +++ b/os1w4/lotto @@ -0,0 +1,2 @@ +#!/bin/sh +seq 42 | shuf | head -n 7 | sort -n | sed -z -e 's/\n/ /g' | awk '1{ print "de lottogetallen zijn: "$1" "$2" "$3" "$5" "$6" "$7", en het reservergetal is: "$4 }' diff --git a/os1w4/practicum.md b/os1w4/practicum.md new file mode 100644 index 0000000..5253cb2 --- /dev/null +++ b/os1w4/practicum.md @@ -0,0 +1,95 @@ +# practicum week 4 + +## 1 + +```bash +$ seq 42 | shuf | head -n 6 | sort -n | sed -z -e 's/\n/, /g' -e 's/..$/\n/' +17, 21, 30, 31, 34, 38 +$ +``` + +## 2 + +```bash +$ ./lotto +de lottogetallen zijn: 1 22 25 30 38 40, en het reservergetal is: 29 +$ ./lotto +de lottogetallen zijn: 2 12 13 18 27 37, en het reservergetal is: 17 +$ ./lotto +de lottogetallen zijn: 19 28 33 38 40 41, en het reservergetal is: 34 +$ +``` + +## 3 + +```bash +$ grep -zoE '<!--\[if.+?\]>.+?<!\[endif\]-->' index.html +<!--[if gte IE 6 ]> + <p>Only IE 6 and greater will see this</p> +<![endif]--> +$ +``` + +## 4 + +```bash +$ grep -zoE '<h2>.+?</h2>' index.html +<h2>Anchor example</h2> +$ +``` + +## 5 + +```bash +$ sed -zE 's#<h2>(.+?)</h2>#<h3>\1</h3>#g' index.html +# de output kan je je wel voorstellen denk ik +``` + +## 6 + +```bash +$ echo "deze zin wordt rot-13 gecodeerd" | tr 'A-Za-z' 'N-ZA-Mn-za-m' +qrmr mva jbeqg ebg-13 trpbqrreq +$ +``` + +## 7 + +```bash +$ awk 'NR % 2 == 0 { print $0 }' lines.txt +tweede regel +vierde regel +zesde regel +achtste regel +tiende regel +$ +``` + +## 8 + +```bash +$ awk -F: '$1 { printf $1 } $5 { printf " ("$5")" } 1 { print "" }' /etc/passwd +root +bin +daemon +mail +ftp +http +nobody (Nobody) +dbus (System Message Bus) +systemd-journal-remote (systemd Journal Remote) +systemd-network (systemd Network Management) +systemd-resolve (systemd Resolver) +systemd-timesync (systemd Time Synchronization) +systemd-coredump (systemd Core Dumper) +uuidd +loek +git (git daemon user) +# dit gaat zo nog even door +``` + +## 9 + +```bash +$ awk '1 { print $4"\t"$1"\t"$3"\t"$2 }' data.csv +``` |