[vox-tech] bash question - how to read specifed amnt of data from a file

Ryan Castellucci vox-tech@lists.lugod.org
Wed, 8 Oct 2003 22:57:19 -0700


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On Wednesday 08 October 2003 11:49 pm, dylan wrote:
> hi-
>
> been playing around with using a basic stamp II to collect environmenta=
l
> data with very minimal setup (CdS cell and capacitor form an RC network=
, RC
> constant is measured by BS II)
> [http://surfdavis.no-ip.com/~dylan/light_level.p2.png]
>
> the BSII sends its data to /dev/ttyS0, and it is read in with the
> command'cat /dev/ttyS0 > tmp.light &' . data is parsed by a simple awk
> script and then sent to ploticus for a nice plot. the plot is updated b=
y
> running a shell script that runs the awk sript and then ploticus.
>
> this works, but there is no way to associate a time with the data value=
s. i
> was thinking that if there was some way to have a bash script read from
> /dev/ttyS0 every 10 seconds or so, save the value to a text file along =
with
> a date stamp it would be pretty neat.
>
> the output from the BSII looks something like this:
> light_level|light_level|light_level   and so on (the delimiter is a pip=
e)
>
> now to the question: does anyone know how to make bash read from a file
> (i.e. the serial port) from one pipe until another pipe, and then save =
the
> value in between to a text file?

echo '<rant>|When starting a new thread, please post to the mailing list =
by=20
composing a new message instead of replying to an unrelated thread|</rant=
>' |=20
cut -d '|' -f 2

- --=20
PGP/GPG Fingerprint: 3B30 C6BE B1C6 9526 7A90  34E7 11DF 44F3 7217 7BC7
On pgp.mit.edu, import with `gpg --keyserver pgp.mit.edu --recv-key 72177=
BC7`
Also available at http://www.cal.net/~ryan/ryan_at_mother_dot_com.asc
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.2 (GNU/Linux)

iD8DBQE/hPi/Ed9E83IXe8cRApFnAJ4xjgRnbh11vPq8GHL6d7yyxjcC8wCfRkDN
9xtZ83ykry2pkLr7B0gMFtU=3D
=3DIDfi
-----END PGP SIGNATURE-----