From: Reid Thompson Date: 2009-10-08T11:26:54+09:00 Subject: Re: lunix split with ruby Ahmet Kilic wrote: > unknown wrote: >> On Wed, Oct 7, 2009 at 11:57 AM, Ahmet Kilic >> wrote: >>> thank you for quick reply. I cold not understand �counter. Where is it >>> coming? >>> like this counter = 0 >>> and �counter file + 1 ??? >> Sorry, yes that was unclear; it was just representing the "aa".."az" >> that split tacks on to the end of the file name. So, I'm thinking >> that will produce output files named like: >> >> file1.txt-aa >> file1.txt-ab >> file1.txt-ac >> file2.txt-aa >> file3.txt-ab >> ... > > sorry for late reply. > I was thinking like that but it was not work for me. > thank you for help. use split -d -l 60000 ${file} ${file}- which should give you files of the format $file-01 $file-02 $file-0... if the split file is going to generate more than 99 files, add -a 4 to the parameters... i.e. split -d -l 60000 MyFile.txt MyFile.txt- gives MyFile.txt-01 MyFile.txt-02 MyFile.txt-03 MyFile.txt-... Then write a script that renames the files ala for file in `ls MyFile.txt-*` do prefix=${file%%.txt*} # echo $prefix suffix=${file##file.txt} # echo $suffix echo ${prefix}${suffix}.txt mv $file ${prefix}${suffix}.txt done