aoc-2021/rename.sh

14 lines
296 B
Bash
Raw Permalink Normal View History

2021-12-13 09:08:40 +00:00
for f in *_day
do
fullfile="$f"
filename=$(basename "$fullfile")
new=$(echo $filename | awk '{split($1,a,"_"); printf "%s",a[1]}')
len=$(echo -n "$new" | wc -c)
if [[ $len == 1 ]]; then
new="0"$filename
else
new=$filename
fi
mv $filename $new
done