Created
August 23, 2011 06:41
-
-
Save erikfrey/1164496 to your computer and use it in GitHub Desktop.
node readline
This file contains hidden or 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
erik@roastbeef:~/proj$ cat child2.js | |
var readline = require('readline'), | |
rl = readline.createInterface(process.stdin, process.stdout); | |
rl.on('line', function(line) { | |
console.log(line); | |
}); | |
erik@roastbeef:~/proj$ time node child2.js < bigfile > derp | |
real 0m0.123s | |
user 0m0.048s | |
sys 0m0.048s | |
erik@roastbeef:~/proj$ wc -l derp | |
100088 derp | |
erik@roastbeef:~/proj$ sort derp | uniq -c | |
10 | |
10 "]} | |
9 ,"bar":"baz","qux":["qoo"]} | |
9 baz","qux":["qoo"]} | |
10 {"fo | |
9 {"foo":1 | |
10 {"foo":1,"ba | |
9 {"foo":1,"bar":" | |
10 {"foo":1,"bar":"baz" | |
10 {"foo":1,"bar":"baz","qu | |
10 {"foo":1,"bar":"baz","qux":[ | |
10 {"foo":1,"bar":"baz","qux":["qoo | |
99922 {"foo":1,"bar":"baz","qux":["qoo"]} | |
10 o":1,"bar":"baz","qux":["qoo"]} | |
10 "qoo"]} | |
10 ,"qux":["qoo"]} | |
10 r":"baz","qux":["qoo"]} | |
10 x":["qoo"]} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment