Permalink
Browse files

Accept 4th parameter to filter OTS input by prefix

  • Loading branch information...
1 parent f3e3881 commit d55f926b6c2f1818b761530c66ae1958b8537ce5 @codehero committed Apr 13, 2012
Showing with 5 additions and 1 deletion.
  1. +5 −1 script/json_ots.js
View
@@ -1,6 +1,10 @@
var fs = require("fs");
var util = require("util");
+/* Accept line prefix parameter. */
+var prefix = "L";
+if(process.argv[3])
+ prefix = process.argv[3];
fs.readFile(process.argv[2], "utf8", function(err, data){
if(err)
@@ -12,7 +16,7 @@ fs.readFile(process.argv[2], "utf8", function(err, data){
var lines = data.split("\n");
lines.forEach(function(line){
/* Skip blank lines or lines without 'L' at beginning. */
- if(!line.length || line.charAt(0) != "L")
+ if(!line.length || line.charAt(0) != prefix.charAt(0))
return;
/* Make sure there is an '=' sign */

0 comments on commit d55f926

Please sign in to comment.