#!/bin/sh
-cp log .log
-cat .log | grep "Mesh for peer" > __tmp_peers
-cat __tmp_peers | while read line; do
+grep "STARTING SERVICE " log > __tmp_peers
+SED_EXPR=""
+while read -r line; do
PEER=`echo $line | sed -e 's/.*\[\(....\)\].*/\1/'`
PID=`echo $line | sed -e 's/.*mesh-\([0-9]*\).*/\1/'`
echo "$PID => $PEER"
- cat .log | sed -e "s/mesh-$PID/MESH $PEER/" > .log2
- mv .log2 .log
-done
-
+ SED_EXPR="${SED_EXPR}s/mesh-\([a-z2]*\)-$PID/MESH \1 $PEER/;"
+ SED_EXPR="${SED_EXPR}s/mesh-$PID/MESH XXX $PEER/;"
+done < __tmp_peers
rm __tmp_peers
-cat .log | sed -e 's/mesh-api-/mesh-api- /g' > .log2
-mv .log2 .log
+SED_EXPR="${SED_EXPR}s/mesh-api-/mesh-api- /g"
+sed -e "$SED_EXPR" log > .log
if [[ "`ps aux | grep "kwrite .lo[g]"`" = "" ]]; then
kwrite .log --geometry 960x1140-960 &