Permalink
Switch branches/tags
Nothing to show
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
executable file 23 lines (17 sloc) 382 Bytes
#!/bin/bash
# With thanks to Daniel Mills, e36freak on #bash
echo '['
files=(./*.txt)
tot=${#files[@]}
for ((i=0; i<tot; i++)); do
d=$(basename "${files[i]}" -count.txt)
n=$(sort -u "${files[i]}" | wc -l)
printf '{ "period" : "%s", "dl" : %s }' "$d" "$n"
# print comma for all lines except last
if ((i == tot - 1)); then
echo
else
echo ,
fi
done
echo ']'