Hi,
there is a little mistake in Damians solution.
If the filename is 8,16,... long then you have two points between the
filename and the extension. Like this :
salidft2001dfa100104011999999999.txt ==> salidft2.001dfa10.01040119.99999999..txt
12345678.txt ==> 12345678..txt
I have another solution for you. It is a little bit larger but it works how you want it.
The same as Damian said :
This assumes that the filenames will not currently contain more than one '.' (and that each has a file extension).
for oldFile in `ls *.txt`
do
newFile=`echo $oldFile | awk ' BEGIN { FS="."}
{
lang=length($1)
x=int(lang / 8)
y=lang / 8
newFile=""
i=0
while (i < x)
{
newFile=newFile""substr($1,i*8+1,8)"."
i=i+1
}
if ( x == y )
{
newFile=newFile""substr($1,i*8+1)""$2
}
else
{
newFile=newFile""substr($1,i*8+1)"."$2
}
print newFile
}'`
#The same as Damian said :
echo mv $oldFile $newFile #remove 'echo' when you're happy
done