I need to rename all filenames (of varying lengths) in directory that end in ".dat.txt" to just ".txt"
INPUT:
FOO.dat.txt, FOO2.dat.txt, SPAM.dat.txt, SPAM_AND_EGGS.dat.txt
DESIRED OUTPUT:
FOO.txt, FOO2.txt, SPAM.txt, SPAM_AND_EGGS.txt
Have been trying to use "rename" but I've never used for this situation before.
for f in DIRECTORY'/'*.dat.txt do rename 's/*.dat.txt/*.txt' * done Thanks for your help!!!
rename *.dat.txt *.txtdoes the job. Not sure if it works inshtoo.