Sleepcount for 300 seconds added. This is when things got riddiculously complicated...
[mirrors/Programs.git] / c / goertzel / sleepcount.sh
CommitLineData
3e5828b5 1#!/bin/bash
991ef83f 2seconds="$2"
3e5828b5 3START=$(head -n 1 "$1" | cut -f 2)
991ef83f 4STARTOK=$({ tail -n 1 "$1.counts.$seconds" || echo 0; } | cut -f 1)
3e5828b5
TM
5STOP=$( tail -n 1 "$1" | cut -f 2)
6
991ef83f
TM
7fuser "$1.counts.$seconds" &>/dev/null && exit 23;
8
3e5828b5
TM
9test "$STARTOK" -gt "$START" && START="$STARTOK";
10seq $START $STOP | while read MAX; do
11 MIN=$(( $MAX - $seconds ))
12 echo -ne "$MAX\t"
13 cat "$1" | cut -f 2,5 | grep -v '\s0' | cut -f 1 | egrep $(echo $(seq $MIN $MAX) | tr ' ' '|') | wc -l
14done >> "$1.counts.$seconds"
This page took 0.121177 seconds and 4 git commands to generate.