Created
July 12, 2017 08:01
-
-
Save thgie/0722207fb49c46012258d54a5163c63e to your computer and use it in GitHub Desktop.
This is a small node.js script that parses an Enex (Evernote export) file for the web.clip url and saves the matches as txt
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
fs = require('fs') | |
fs.readFile('Evernote.enex', 'utf8', function (err,data) { | |
if (err) { | |
return console.log(err); | |
} | |
var pattern = /<source>web.clip<\/source><source-url>(.*?)<\/source-url>/g | |
var matches = [], match = pattern.exec(data) | |
while (match != null) { | |
matches.push(match[1]) | |
match = pattern.exec(data) | |
} | |
console.log(matches.length) | |
var result = matches.join('\r\n') | |
fs.writeFile('result.txt', result, function(err) { | |
if(err) { | |
return console.log(err); | |
} | |
console.log('The file was saved!'); | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment