TIP: Click on subject to list as thread! ANSI
echo: linux_bbs
to: All
from: Maurice Kinal
date: 2003-10-20 14:26:46
subject: offline

Hey All!

I started working on a bash scripted offline messaging filter to convert
raw pkt's to a suitable format for a ncurses based offline messaging thingy
I am working on.  So far I figured out how to get each individual message
within a pkt, as well as multiple pkt's, to output to a temporary file with
all the needed information to further reconstruct something that can be
operated on.  I would appreciate any input on what I currently have going
on before deciding on the final output.  Here is the first draft of the
filter:

   ----- unpackit.sh begins -----
#!/bin/sh
rm -r ~/mikey/inbound/temp && cd ~/mikey/inbound && mkdir
temp && cd temp
for i in ~/mikey/files/*.pkt ; do
        echo "Processing packet: $i"
        cat $i \
        | cut -c 61- \
        | sed s/'\x0d\x00\x02\x00'/'\x0d\n'/g \
        | cut -c 13- \
        | sed s/'\x00\x00\x00'//g \
        >> ../temp.data
done
gzip -9 ../temp.data
   ----- unpackit.sh ends -----

Each pass of the for loop loads a found raw pkt, echoes the pkt name to
screen (later to be a logfile), cuts out the pkt header (unneeded
information), finds and replaces the end of message string resulting in
each msg outputted on it's own line, cuts out the msg header (unneeded
information), removes the end of pkt string, and finally outputs all the
filtered data to temp.data.  When the for loop has done it's thing the
script the gzips the result so that it takes up roughly 30% of the space
the original unzipped file did.  I originally had sed doing a one pass
operation for replacement of both the end of message/pkt strings but it
screws up by adding a blank line when it adds a "\n" to the end
of pkt string which isn't wanted.  By having it seperate and last then the
outputted temp.data is exactly what I am looking for.

Now what I need is a final format so that the actual message in each line
is displayed properly with all the fields seperated and read in as
variables (e.g. MSGID).

Any takers/helpers?

Life is good,
Maurice

--- Msged/LNX 6.1.1
* Origin: LMBrain Pointy System (1:153/401.1)
SEEN-BY: 633/267 270
@PATH: 153/401 307 140/1 106/2000 633/267

SOURCE: echomail via fidonet.ozzmosis.com

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.