Skip to content

Instantly share code, notes, and snippets.

@thgie
Created July 12, 2017 08:01
Show Gist options
  • Save thgie/0722207fb49c46012258d54a5163c63e to your computer and use it in GitHub Desktop.
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
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