Skip to content

Instantly share code, notes, and snippets.

@Sekhmet
Created November 1, 2015 15:37
Show Gist options
  • Save Sekhmet/445a9f22775d83afdce9 to your computer and use it in GitHub Desktop.
Save Sekhmet/445a9f22775d83afdce9 to your computer and use it in GitHub Desktop.
parser
var fs = require('fs');
var readline = require('readline');
var file = process.argv[2];
if(!file) {
console.log("Usage: \n\t node index.js file.txt");
process.exit(1);
}
var lineparser = readline.createInterface({
input: fs.createReadStream(file),
output: process.stdout,
terminal: false
});
lineparser.on('line', function(line) {
var number = line.match(/([0-9]+)/);
if(number[0] && number[0] < 10000) {
console.log(line);
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment