2022-12-07 10:01:19 +00:00
|
|
|
BEGIN { LIMIT=100*1000 }
|
|
|
|
$2 == "ls" || $1 == "dir" { next}
|
|
|
|
$2 == "cd" && $3 == ".." {
|
|
|
|
if (S[depth]<=LIMIT) {
|
|
|
|
R+=S[depth]
|
|
|
|
}
|
|
|
|
S[depth]=0
|
|
|
|
depth -= 1
|
|
|
|
}
|
2022-12-08 11:45:00 +00:00
|
|
|
$2 == "cd" && $3 != ".." { depth ++ }
|
2022-12-07 10:01:19 +00:00
|
|
|
NF == 2 {
|
|
|
|
for (i=1;i<=depth;i++) {
|
|
|
|
S[i]+=$1
|
|
|
|
}
|
|
|
|
}
|
|
|
|
END { print R }
|