Find and split the list of files with suffiz of seg**

Hi,.

I am writing a script to get the new files and split them.

Requirement
Find the new files under the path "/wload/scmp/app/data/OAS" (There are 5 sub folders).
Gunzip the files which are having .gz suffix.
Put the list of files in the filename in the format "fiels_to_split_2013012911300.txt where as the numeric part is date and time.
Perform the split command on the files to split each file containing 50000 lines.
The output of the split filename should have the same file with suffix seg** where ** can be either numbers or alphabets.

I got the code from Pikk45 and tried to add/modify as per the need.

find /wload/scmp/app/data/OAS -name "*.gz" -size +100000000 -type f -mtime -1 -exec gunzip {} \;
FILENAME=new_fiels_to_split$(date +"%Y%m%d%H%M").txt
find /wload/scmp/app/data/OAS -type f -mtime -1 > /wload/scmp/app/data/OAS/$FILENAME
FILES=/wload/scmp/app/data/OAS/$FILENAME
FIRST=1
FILE=1
SPL=50000
while read file; do
 split -l 50000 "$FILENAME" "$FILENAME".seg
 done < ${FILES}
FIRST=`expr $FIRST + 50000`
SPL=`expr $SPL + 50000`
FILE=`expr $FILE + 1`

for example
the source files

-rw-rw-r-- 1 scmpadm scmpuser 755861762 Jan 26 20:04 activity.log.20130125.gz
-rw-rw-r-- 1 scmpadm scmpuser 0 Jan 26 20:05 trigger.activity.log.20130125
-rw-rw-r-- 1 scmpadm scmpuser 913911244 Jan 27 20:24 activity.log.20130126.gz
-rw-rw-r-- 1 scmpadm scmpuser 0 Jan 27 20:25 trigger.activity.log.20130126
-rw-rw-r-- 1 scmpadm scmpuser 329351168 Jan 28 19:10 activity.log.20130127.gz

After gunzip

-rw-rw-r-- 1 scmpadm scmpuser 3012939863 Jan 28 19:10 activity.log.20130127

Files after split

-rw-rw---- 1 scmpadm scmpuser 49877675 Jan 29 07:04 activity.log.20130127.segaa
-rw-rw---- 1 scmpadm scmpuser 47552800 Jan 29 07:07 activity.log.20130127.segab
-rw-rw---- 1 scmpadm scmpuser 45867421 Jan 29 07:08 activity.log.20130127.segac
-rw-rw---- 1 scmpadm scmpuser 48985303 Jan 29 07:09 activity.log.20130127.segad
-rw-rw---- 1 scmpadm scmpuser 50846638 Jan 29 07:10 activity.log.20130127.segae
-rw-rw---- 1 scmpadm scmpuser 50946829 Jan 29 07:13 activity.log.20130127.segaf
-rw-rw---- 1 scmpadm scmpuser 50968144 Jan 29 07:14 activity.log.20130127.segag
-rw-rw---- 1 scmpadm scmpuser 51758156 Jan 29 07:18 activity.log.20130127.segah
-rw-rw---- 1 scmpadm scmpuser 52290589 Jan 29 07:23 activity.log.20130127.segai
-rw-rw---- 1 scmpadm scmpuser 19329024 Jan 29 07:26 activity.log.20130127.segaj