I have a file like this:
DDD_ABCDE2AB2_1104081408.104480
I need to remove the 1 after the . in the file name so that it reads:
DDD_ABCDE2AB2_1104081408.04480
Having some difficulty getting the command to work. I tried using
cut -d 26
but that just doesn't work.
Scott
2
Hi.
You have a file, or a filename like that?
# X=DDD_ABCDE2AB2_1104081408.104480
# echo ${X/.[^.]/.}
DDD_ABCDE2AB2_1104081408.04480
That's an interesting piece of code. I got it to work by doing this:
First grab a list of all the files, then:
while read line
do drop1=`echo $line | cut -c -25,27-`
mv $line $drop1
done < files.list
It works.
ctsgnb
4
# a=DDD_ABCDE2AB2_1104081408.104480
# a=${a%.*}.${a##*.?}
# echo $a
DDD_ABCDE2AB2_1104081408.04480
same
# a=DDD_ABCDE2AB2_1104081408.104480
# echo ${a%.*}.${a##*.?}
DDD_ABCDE2AB2_1104081408.04480