Date: Mon, 30 Jan 1995 07:38:51 -0600 (CST) From: Tim Lavoie To: rsisk@med.unc.edu Subject: R.M.R. submission (included here) Message-Id: Mime-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Status: R Here is a small utility for use with Digitrak, just to split the data files into two-column format for programs like gnuplot. I posted this to the newsgroup too, but here goes anyway. ---------------------------Cut-here----------------------------------------- This is my quick hack to make Digitrak output files easier to process with programs such as gnuplot. What it needs: Bourne shell or equivalent, and an interpreter for scripts written for the AWK language. Gnu awk (a.k.a. "gawk") and the bash shell used in Linux are fine here. What it does: This takes the output file from the command line, and processes it three times, once per awk script. Three new files are then created, with only two data columns instead of five. The time is the first column, followed by either altitude, velocity or acceleration. How to use: Just type "dt_split filename", minus the quotes of course. Three new files will be created, with the extensions .acc, .alt, and .vel added to the base filename. Porting notes: This should work on just about any system, with minor mods: MS-DOS users will want to just make sure that the base filename is only eight characters long, with no extension. Otherwise, an illegal filename will result. If the Bourne shell or equivalent isn't handy, just rewrite the main script in the language of choice. I *had* written the whole thing in normal ANSI C, but a hard- drive crash ate it. This works (for me), and took less time to write. if you'd really like a C version, let me know, and I'll do it eventually. Email address: tim@asylum.magic.mb.ca (preferred) umlavoi6@cc.umanitoba.ca (school) ---- Cut Here and unpack ---- #!/bin/sh # shar: Shell Archiver (v1.22) # # Run the following text with /bin/sh to create: # dt_split # dt_acc.awk # dt_alt.awk # dt_vel.awk # if test -f dt_split; then echo "File dt_split exists"; else echo "x - extracting dt_split (Text)" sed 's/^X//' << 'SHAR_EOF' > dt_split && X#!/bin/sh Xawk -f dt_vel.awk $1 > $1.vel Xawk -f dt_alt.awk $1 > $1.alt Xawk -f dt_acc.awk $1 > $1.acc SHAR_EOF chmod 0755 dt_split || echo "restore of dt_split fails" set `wc -c dt_split`;Sum=$1 if test "$Sum" != "100" then echo original size 100, current size $Sum;fi fi if test -f dt_acc.awk; then echo "File dt_acc.awk exists"; else echo "x - extracting dt_acc.awk (Text)" sed 's/^X//' << 'SHAR_EOF' > dt_acc.awk && X/^#/ {print} X!/^#/ {print $5 " " $3} X/^# Alt/ {print"# Time Acceleration"} SHAR_EOF chmod 0644 dt_acc.awk || echo "restore of dt_acc.awk fails" set `wc -c dt_acc.awk`;Sum=$1 if test "$Sum" != "77" then echo original size 77, current size $Sum;fi fi if test -f dt_alt.awk; then echo "File dt_alt.awk exists"; else echo "x - extracting dt_alt.awk (Text)" sed 's/^X//' << 'SHAR_EOF' > dt_alt.awk && X/^#/ {print} X!/^#/ {print $5 " " $1} X/^# Alt/ {print "# Time Altitude"} SHAR_EOF chmod 0644 dt_alt.awk || echo "restore of dt_alt.awk fails" set `wc -c dt_alt.awk`;Sum=$1 if test "$Sum" != "74" then echo original size 74, current size $Sum;fi fi if test -f dt_vel.awk; then echo "File dt_vel.awk exists"; else echo "x - extracting dt_vel.awk (Text)" sed 's/^X//' << 'SHAR_EOF' > dt_vel.awk && X/^#/ {print} X!/^#/ {print $5 " " $2} X/^# Alt/ {print "# Time Velocity"} SHAR_EOF chmod 0644 dt_vel.awk || echo "restore of dt_vel.awk fails" set `wc -c dt_vel.awk`;Sum=$1 if test "$Sum" != "74" then echo original size 74, current size $Sum;fi fi exit 0