On Wed, Oct 7, 2009 at 11:25 AM, Ahmet Kilic <ahmedkilic / gmail.com> wrote:
> unknown wrote:
>> On Wed, Oct 7, 2009 at 6:19 AM, Ahmet Kilic <ahmedkilic / gmail.com>
>> wrote:
>>> file1-1.txt
>>> file1-2.txt
>>> file1-3.txt
>>> ....
>>>
>>> how can i do it ?
>>>
>>> please help me.
>>
>> What (incorrect) output does your current script produce?
>
> the output is only
> xaa
> xab
> xac
> xad
> ...
>
> I want to loop all files and split for each around 1mb.

Okay, that helps; looks like by default split names the files "xaa".."xzz":

http://unixhelp.ed.ac.uk/CGI/man-cgi?split

As as first pass (still won't be quite what you asked for) try changing:

  "split -l 60000 #{file}"

to:

  "split -l 60000 #{file} #{file}-"

that should change the output file names from "x" + "#{counter}" to
"#{file}" + "-" + "#{counter}"