From 52447f70cc29857f37dc4ef6a3e4f10d5fd5c110 Mon Sep 17 00:00:00 2001 From: Christian Weiske Date: Thu, 27 Jan 2011 22:11:49 +0100 Subject: [PATCH] beginning to work on the tools :) --- README | 12 ++++++++++++ lines-to-stdout.php | 9 +++++++++ multilinefile | 6 ++++++ work-with-lines.sh | 26 ++++++++++++++++++++++++++ 4 files changed, 53 insertions(+) create mode 100644 README create mode 100644 lines-to-stdout.php create mode 100644 multilinefile create mode 100755 work-with-lines.sh diff --git a/README b/README new file mode 100644 index 0000000..a2ad7a3 --- /dev/null +++ b/README @@ -0,0 +1,12 @@ +1. pipe each received line to a command +2. command splits up line into variables +3. add variable data to rrdtool +4. repeat + + +idea: cat socat output to "read" + + + +Test it: +$ php lines-to-stdout.php | ./work-with-lines.sh diff --git a/lines-to-stdout.php b/lines-to-stdout.php new file mode 100644 index 0000000..eb6b39d --- /dev/null +++ b/lines-to-stdout.php @@ -0,0 +1,9 @@ + \ No newline at end of file diff --git a/multilinefile b/multilinefile new file mode 100644 index 0000000..00c077e --- /dev/null +++ b/multilinefile @@ -0,0 +1,6 @@ +line1 +line2 +line3 +a +b +c diff --git a/work-with-lines.sh b/work-with-lines.sh new file mode 100755 index 0000000..9e52c9d --- /dev/null +++ b/work-with-lines.sh @@ -0,0 +1,26 @@ +#!/bin/sh + +#split words by semicolons +IFS=";" + +#Beispielausgabe USB-WDE1: +# $1;1;;13,8;22,7;22,6;17,8;22,2;21,2;22,9;;59;35;38;49;38;40;35;;;;;;;0 +# Doku des Formats in 92030_USB_WDE1_V1.0_UM.pdf bei elv.de verfügbar + +#Variablenamen: +# t1-t8: Temperatur in °C der Sensoren 1-8 +# f1-f8: Feuchtegrad in % der Sensoren 1-8 +# tc: Temperatur Kombinsensor in °C +# fc: Feuchtegrad Kombinsensor in % +# wg: Windgeschwindigkeit in km/h +# ns: Niederschlag (Wippenschläge) +# regen: Regen 1=ja, 0=nein +while read -r startzeichen zustand zeitstempel\ + t1 t2 t3 t4 t5 t6 t7 t8\ + f1 f2 f3 f4 f5 f6 f7 f8\ + tc fc wg ns regen +do + echo "line:" + echo 1: $one , 2: $two, 3: $three, 4: $four +done +echo "done with everything" -- 2.30.2