indexer: notabug.io
all comments

[]x0x7 -0 points

Ultimately I want to find the unique values between two times

gt -1553208420411 | lt -1553208652110 | cut -d'\t' -f2 | sort | uniq < myfile

[]x0x7 -0 points

The equivalent nodejs code

#!/usr/bin/env node
var start = parseInt(process.argv[2]);
var end = parseInt(process.argv[3]);
var rl = require('readline').createInterface({input:process.stdin});
var set = new Set();
rl.on('close',()=>{
 console.log([...set.keys()].join('\n'));
});
rl.on('line',line=>{
 var [time,item] = line.split('\t');
 time = parseInt(time);
 if(time>start&&time<end) {
  set.add(item);
 }
});

[] -0 points

ive seen this done with sed and awk, using a start pattern and end pattern, printing all lines between these including the start and end pattern lines

[] -0 points

cat file | sed -n '/START_PATTERN,/END_PATTERN/p'

[] -0 points

I must admit that since I've started using vim I almost never touch sed anymore.

But that's pretty nice.

π