#!/bin/bash num_training_lines=40 num_test_lines=3000 # nothing to change from here on total_lines=$((num_training_lines+num_test_lines)) perl -e ' srand(1981); @inps=(0)x6; for($i=0;$i<'${total_lines}';$i++){ for($j=0;$j<6;$j++){ $inps[$j] = int(rand()*10000000000) % 2 } $out = boolean_function(@inps); print join("\t", @inps)."\t$out\n"; } sub boolean_function { return (($_[0] && $_[1]) || ($_[1] && $_[3])) && ($_[4] || $_[5] || $_[0]) ? "1" : "0"; } ' > data head -${num_training_lines} data > train tail -${num_test_lines} data > test