0

PQPZ3.DATR.QRL.R9529.D090295.T19501.das.1333332287722.1.2.err

I have AIX so I can't use rename hopeing for something easier but I need to find all the files in the directory and then any of them that have a .err on them I need to be able to rename them back all the way to the .das

So I need to go from

PQPZ3.DATR.QRL.R9529.D090295.T19501.das.1333332287722.1.2.err

to

PQPZ3.DATR.QRL.R9529.D090295.T19501.das

When I have many .err's one quick script to rename them all back to the .das

3
Contributors
4
Replies
5
Views
10 Years
Discussion Span
Last Post by masijade
0

I tried something like this but it just adds a .das at the end of the whole file...

for i in *.das; do mv "$i" `basename $i`.das; done

0

You have to use either ksh (zsh) or bash to do this - ie., a modern shell with pattern matching.

cd /path/to/files
find . -name '*.err' |\
while read file
do
	tmp=${file%%.das*}
	mv $file "$file".das
done

Test it somewhere first!

0

This just added the .das at the end of the .err I need something to remove it all the way back tot he .das

PQPZ3.DATR.QRL.R9529.D090295.T19501.das.1333332287722.1.2.err

to

PQPZ3.DATR.QRL.R9529.D090295.T19501.das

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.