blob: 83c3d1ad8ac737e89b7368f714a1193690b6d370 (
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
|
#!/usr/bin/awk -f
function convtobytes(num) {
if (match(num, " K"))
mul = 1000
else if (match(num, " M"))
mul = 1000 * 1000
else if (match(num, " G"))
mul = 1000 * 1000 * 1000
else
mul = 1
return int(num * mul)
}
BEGIN {
cmd = "czkawka_cli image -d $PWD"
FS = " - "
largestsize = 0
imc = 0
k = 0
while (cmd | getline) {
print $0
if (!match($0, "^/")) {
delete images
largestsize = 0
imc = 0
k++
break
}
images[$imc] = $0
if (size = convtobytes($3) > largestsize) {
largestsize = size
keep[$k] = $1
}
imc++
}
for (image in keep) {
print $image
}
}
|