Created
November 1, 2015 15:37
-
-
Save Sekhmet/445a9f22775d83afdce9 to your computer and use it in GitHub Desktop.
parser
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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