#! /bin/bash ## # This script adds the name of the episode by parsing the list taken from epguides.com # shortend to only contain the episodes of the current season in a specific text File. # This file has to start with the first episode. # All the video files have to be in chronological order. # # I definitely need to learn Perl to do a better script!!! ## episode=1; for file in *.avi; do line=$(awk 'FNR == "'"$episode"'"' season1.txt); name=${line:39}; if [ ${#episode} -eq 1 ]; then newname="Scrubs 8x0${episode} $name.avi"; else newname="Scrubs 8x${episode} $name.avi"; fi; #cp "$file" "$newname"; echo $newname; episode=$(( $episode + 1 )); done