intent resum fitxers baixats

This commit is contained in:
Xaloc 2024-01-18 15:58:21 +01:00
parent cfcd4d5590
commit 4ae8fe22b6

View File

@ -1,9 +1,14 @@
#!/bin/bash
output="./${!#}.log"
sites_output="./${!#}_sites.log"
mides_output="./${!#}_mides.log"
year=$(date +"%Y")
echo "Analitzant ${!#}..."
sleep 1s
echo "Pot tardar una estona..."
echo ""
wget \
--recursive --level=1 \
@ -20,9 +25,18 @@ then
grep -e "Content-Length" "$output" | \
awk '{sum+=$2} END {printf("%.0f", sum / 1024)}'\
) kb"
echo ""
sleep 1s
grep -e "--$year" $output | awk '{printf("%s\n", $3)}' >> $sites_output
sed -i '$ d' $sites_output
grep -e "Content-Length" $output | awk '{printf("%.2fKb\n", $2 / 1024)}' >> $mides_output
echo "## Resum dels fitxers baixats ##"
sleep 1s
echo "$(paste $sites_output $mides_output | uniq)"
# Delete wget output file
rm "$output"
rm "$sites_output"
rm "$mides_output"
else
echo "Unable to calculate estimated size."
exit 1