Files
gists/codegrab/depth
2022-05-13 12:50:20 +02:00

19 lines
267 B
Bash
Executable File

#!/bin/bash
file="${1}"
stag="${2}"
max=0
open=0
grep -Po "</?${stag}" "${file}" | while read tag; do
if [[ "$tag" == "<${stag}" ]] ; then
(( open++ ))
else
(( open--))
fi
echo "$open - $max"
if [[ $open -gt $max ]] ; then
max=$open
fi
done