hi Rvbs,
i dont think so if its possible to change the format of "split" command as per your requiremnet, so i guess you have to write a shell script to modify the ouput of "split" command.
i have written a sample shell script which will split the files into your desired format (suffix as numerals).
please test the same
....n tell me if it works fine
...
note:
1. you have to pass the name of file to split and the number of lines for splitting the input files, as the command line argumnets ($1 and $2 in the same order as above)
2. run the script from same directory/shell where your input file is existing or else give the proper path
3. you can modify the split command used here for any different options/flags...as per your requirement.
script:
set -x
#/usr/bin/sh
export name_of_file_to_split=$1
export num_of_lines=$2
export PWD=`pwd`
export len_of_input_file_name=`echo $name_of_file_to_split | wc -c`
export len_of_input_file_name=`expr $len_of_input_file_name - 1`
split -l "$num_of_lines" $name_of_file_to_split $name_of_file_to_split
ls $name_of_file_to_split* > temp_file
export input_file=$PWD/temp_file
number_of_sub_files=`cat $input_file | wc -l`
i=2
while [ $i -le $number_of_sub_files ]
do
old_file_name=`cat $input_file | head -"$i" | tail -1`
len=`echo $old_file_name | wc -c`
len=`expr $len - 1`
len_to_cut=`expr $len_of_input_file_name + 1`
old_suffix=`echo $old_file_name | cut -c "$len_to_cut"-"$len"`
new_suffix=`echo $old_suffix | tr a-z 0-9`
mv $old_file_name "$name_of_file_to_split""$new_suffix"
i=`expr $i + 1`
done
rm -f temp_file
regards,
Bhups