Created
August 22, 2012 22:12
-
-
Save soldair/3429947 to your computer and use it in GitHub Desktop.
nodejs oneliner to reverse text on all lines of /etc/passwd from stdin to stdout
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
cat /etc/passwd | node -e "var buf ='',rev=function(lines){lines.forEach(function(l,k){process.stdout.write(l.split('').reverse().join('')+'\n')})};process.stdin.on('data',function(b){buf+=b.toString();b = buf.split('\n');buf = b.shift();rev(b)}); process.stdin.resume();" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment