David Phillips writes:
>> 2) Split a log file into 2 files so that a certain number of lines
>> are removed from the primary file and dumped into a secondary file
>
> split -nLINES logfile tmp && mv tmpaa old && mv tmpab logfile

Oops, this only works if LINES is no less than half the number of lines in
logfile (and it's -l not -n).  For smaller numbers, try this:

NUM=$(wc -l logfile | awk '{print $1}')
head -nLINES logfile > old && \
tail -n$(echo "$NUM - LINES" | bc) logfile > tmp && \
mv tmp logfile

-- 
David Phillips <david at acz.org>
http://david.acz.org/


_______________________________________________
TCLUG Mailing List - Minneapolis/St. Paul, Minnesota
http://www.mn-linux.org tclug-list at mn-linux.org
https://mailman.real-time.com/mailman/listinfo/tclug-list