Split file wc -l
Here's a stab at it.
==========Script follows ===========
#!/bin/ksh
filename=$1
tline=$(wc -l $filename | awk '{print $1}')
let hline=$tline/2
split -l $hline $filename
=========== End of script ==========
This will output 2 files, call xaa and xab by default, check the man page for split to see how to make it what you want.
Syntax to execute it is scriptname [file_to_be_split]
Variable definitions
filename - file to be split
tline - number of lines in the file
hline - 1/2 of the number of lines in the file
Hope this helps, sure there are other ways.
Last edited by olenkline; 02-19-2008 at 05:52 PM..
Reason: Use of obsolete ` in Ksh script, and forgot a '