const fs = require('fs'); const step = 50; let input = fs.readFileSync('cdf-full.dat', 'utf-8') .split('\n') .map((x) => x.split(' ')); let output = []; for (let i = 0; i < input.length; i += step) { output.push(input[i]); } fs.writeFileSync('cdf.dat', output.map((x) => x.join(' ')).join('\n'));