function readFile(inPath, useHeader, regex) {

	var index = 0;
	var outData = [];

	var readStream = fs.createReadStream(inPath)
		.pipe(split())
		.on('data', function (line) {

			line = line.toString().match(regex);

			if(line){

				if(useHeader && index == 0){
					setHeaderRowAsKeys(line);
				}
				else if(useHeader) {
					// create an object with header row keys
					line = addKeys(line);
					outData.push(line);
				}
				else {
					// array, no keys
					outData.push(line);
				}

				index++;
			}
		});

	readStream.on('end', function () {
		writeFile(outData, yargs.o);
	});
}
function readFile(inPath, useHeader, regex) {

	var index = 0;
	var outData = [];

	var readStream = fs.createReadStream(inPath)
		.pipe(split())
		.on('data', function (line) {

			line = line.toString().match(regex);

			if(line){

				if(useHeader && index == 0){
					setHeaderRowAsKeys(line);
				}
				else if(useHeader) {
					
					line = addKeys(line);
					outData.push(line);
				}
				else {
					
					outData.push(line);
				}

				index++;
			}
		});

	readStream.on('end', function () {
		writeFile(outData, yargs.o);
	});
}
function readFile ( inPath , useHeader , regex ) { var index = 0 ; var outData = [ ] ; var readStream = fs . createReadStream ( inPath ) . pipe ( split ( ) ) . on ( 'data' , function ( line ) { line = line . toString ( ) . match ( regex ) ; if ( line ) { if ( useHeader && index == 0 ) { setHeaderRowAsKeys ( line ) ; } else if ( useHeader ) { // create an object with header row keys line = addKeys ( line ) ; outData . push ( line ) ; } else { // array, no keys outData . push ( line ) ; } index ++ ; } } ) ; readStream . on ( 'end' , function ( ) { writeFile ( outData , yargs . o ) ; } ) ; }
/[^\t]+/g
/ [ ^ \ t ] + / g