-
-
Save phx/5770979 to your computer and use it in GitHub Desktop.
increment a variable inside a for loop to rename all text files that start with a certain string.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
for files in old*.txt | |
do | |
((i++)) | |
mv $files $(echo $files | sed -E 's/[0-9]+\.txt//')OLDOLD$i.txt | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment