Skip to content

Instantly share code, notes, and snippets.

@ChrisCinelli
Created August 9, 2017 20:41
Show Gist options
  • Save ChrisCinelli/682bcecd8cdae3cc61002c0fab8cbd75 to your computer and use it in GitHub Desktop.
Save ChrisCinelli/682bcecd8cdae3cc61002c0fab8cbd75 to your computer and use it in GitHub Desktop.
Convert text in one line of text for each line for faster comparison
// Usage: node fromTextToOneWordForLine.js < infile >outfile
// You can then use opendiff to find the real differences
var fs = require('fs');
var stdinBuffer = fs.readFileSync(0); // STDIN_FILENO = 0
var text = stdinBuffer.toString();
console.log(text.replace(/(\s|[^a-z])+/gi, '\n'));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment