calculations in bash

HI

i have following problem,
i need to use split command to split files each should be cca 700 lines but i dont know how to inplement it in the scripts becasuse each time the origin file will be various size ,
any body got any idea

cheers

Can you clarify how you want to split the file, in a fix number of files or lines?

Regards

Are you using the split command?


cat filename | wc -l  | read linecount

maxpgcnt=680 
l=$(( $linecount % $maxpgcnt ))
while [[ $l -gt 0  && $l -lt $(( $maxpgcnt - 20 )) ]]
do
       maxpgcnt=$(( $maxpgcnt + 1 )) 
       l=$(( $linecount % $maxpgcnt ))
done

split -l $l filename