summaryrefslogtreecommitdiff
path: root/os1w4/practicum.md
blob: 5253cb26aabc1147d0b48558d70789e3b1683257 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
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
```