- 追加された行はこの色です。
- 削除された行はこの色です。
***G2+dplusログの整形 [#d6be8638]
/var/log/dplus.log から、時刻、MyCALL UrCALL RPT1 RPT2 を抽出してLISTアップするScript
---- access.sh ---
#!/bin/bash
export TZ='Asia/Tokyo'
touch /root/up02.txt
touch /root/acs01.txt
while :
do
tail -1000 /var/log/dplus.log | grep -e "Remote client forward start" -e "User update" -e "Remote dongle tx start" -A1 > /root/up01.txt
while read line
do
FL1=`echo "$line" | grep -e "Remote client forward start"`
FL2=`echo "$line" | grep -e "User update"`
FL3=`echo "$line" | grep -e "rpt2"`
FL5=`echo "$line" | grep -e "Remote dongle tx start"`
if test "$FL1" != ""; then
DTXD=`echo "$line" | cut -d" " -f8- | cut -b1-16`
fi
if test "$FL5" != ""; then
DTXD=`echo "$line" | cut -b57-72`
# echo "dongle time = $DTXD"
fi
if test "$FL2" != "";then
FL4=`echo "$line" | grep -e "JP1YJQ S"`
if test "$FL4" = ""; then
DTXD=`echo "$line" | cut -b39-54`
MCL0=`echo "$line" | cut -b14-21`
MCL="$MCL0 "
RPT1=`echo "$line" | cut -b29-36`
RPT2=" "
UCL=" "
fi
fi
if test "$FL3" != ""; then
RPT2=`echo "$line" | cut -b7-14`
RPT1=`echo "$line" | cut -b23-30`
UCL=`echo "$line" | cut -b41-48`
MCL=`echo "$line" | cut -b59-71`
fi
echo "$DTXD $MCL $UCL $RPT1 $RPT2" >> /root/up02.txt
# echo "$DTXD $MCL $UCL $RPT1 $RPT2"
done < /root/up01.txt
sort /root/up02.txt | uniq | tail -100 > /root/acs.txt
sleep 1
rm -f /root/up02.txt
touch /root/up02.txt
sleep 1
while read line
do
DTEDT=`echo "$line" | cut -b1-16 | sed 's/\//-/g'`
MSG0=`echo "$line" | cut -b18-`
DTTEMP=`date +%s --date "$DTEDT"`
DTJST=`expr $DTTEMP + "50400"`
DTJST0=`date +"%Y-%m-%d %T" --date "@$DTJST"| cut -b1-16`
echo "$DTJST0 $MSG0" >> /root/acs01.txt
# echo "$DTJST0 $MSG0"
done <acs.txt
CHK1=`tail -1 /root/acsorg.txt`
CHK2=`sort /root/acs01.txt | sort | uniq | sed -e '$d'|tail -1`
if test "$CHK1" != "$CHK2"; then
sort /root/acs01.txt | sort | uniq | sed -e '$d' >> /root/acsorg.txt
fi
sort /root/acs01.txt | sort | uniq | sed -e '$d' > /root/acs_jst.txt
sleep 1
rm -f /root/acs01.txt
touch /root/acs01.txt
sleep 1
done
#clean
#clear
#comment
#navi(日記)