How to export specific lines from a text/log file into a new text file using a DOS batch.

One of my customers using the AppGen on OpenScape Xpressions V5.0 R3 (MRS. 7.11) had a pretty usual query; they wanted to get a report that displays every call that hit the Auto Attendant outside the business hours. The CDR crew could not really get it done because the call is not in every case forwarded to the voicemail I had to find a way in Xpressions. There is a flag now you can set on the boxes that is called Generate raw data for statistics that is checked by default.

appgen_raw_data

Looking into the installation dir you will see a folder e.g. c:\siemens\xpr\Stat which contains all of those log files. Unfortunately there are a couple of other entries in that file than the one with the inbound call function. It content looks like this:

Telematic    Physical Lines    2009.03.03.19.52.10    System=1    Mode=I    Board=4    Channel=2    Used=1    Total=2    BoardID=1I4    Status=IN
Telematic    Physical Lines    2009.03.03.19.52.55    System=1    Mode=I    Board=4    Channel=2    Used=0    Total=2    BoardID=1I4    Status=FREE
Telematic    PHONEMAIL    2009.03.03.19.52.57    Access=CB    Caller=+123456789    Lang=2057    Time=47    Errors=0    Result=UD    Call=    Mailbox=180    Sent=0    Count=1    Age=0    Diff=1
Telematic    Event    2009.03.03.19.52.57    Protocolname=PHONEMAIL    Source=TUI    ScriptID=3    NumSubscribers=307
Telematic    Call    2009.03.03.19.52.57    Protocolname=PHONEMAIL    Source=TUI    ScriptID=3    NumSubscribers=307    Subscriber=Ger Reynolds    Extension=+123456789    UserId=180    Caller=+123456789    AccessMode=CALLBACK    Duration=47    Success=UNKNOWN
Telematic    Call Processing Call    2009.03.03.19.52.57    Protocolname=PHONEMAIL    Source=TUI    ScriptID=3    NumSubscribers=307    Success=COMPLETED    Type=VOICE
Telematic    Physical Lines    2009.03.03.20.03.00    System=1    Mode=I    Board=5    Channel=1    Used=1    Total=30    BoardID=1I5    Status=IN
Telematic    IVR Box    2009.03.03.20.03.00    UniqueID=4611767028170358873    BoxName=Timeprofile    BoxType=TIME    StartTime=2009.03.03.20.03.00    Duration=0    DTMF=    ASRKeyword=    ASRConfidence=    ACDGroup=    TimeProfile=BAUSCHLOMB    Result=STATE BREAK    NextBox=Menue_1_Good_Evening    ForwardNumber=    Script=

So I had to find a way to separate the lines that contain the information “Status=IN” which stands for an inbound call into the box. In order to get this done I created a batch file that is using a command I published already in the Windows 2003 basic administration guide on that website.
Create a batch file and name it for example export.bat and put it into the Xpressions installation directory (C:\siemens\xpr\export.bat) and enter the following lines:

echo off
cls
REM Stop Xpressions
net stop mrs
REM Create backup Folder
mkdir statbackup2
REM Backup Status Files
xcopy /E statbackup\*.log statbackup2
REM Remove old status files
del statbackup\*.log
mkdir statbackup
REM Backup Status Files
xcopy /E stat\*.log statbackup
REM Find Incoming call and export into text file
find "Status=IN" stat\*.log > data.txt
REM Remove log file
xcopy /E data.txt data_old.txt
del data.txt
REM Remove old status files
del stat\*.log
REM Start Xpressions
net start mrs
REM Finished

This batch is stopping the Xpressions in order to close the connection to the log file, backs the files up and reads the information using find “Status=IN” stat\*.log and outputs it into the file data.txt. After the file is created it deletes the content of the stat folder and starts Xpressions again. In this case you have no duplicate entries in the data.txt file on the next export. Schedule this task to repeat itself daily for daily statistics.

Tomorrow I will show you how to import that collected data into a mysql database using the same batch file and setup a small query page to access this information that will look like this:

http://me.go-unified.com/appgen/ (This is still Alpha 1 release and a lot of work has to be done!)

3 comments to How to export specific lines from a text/log file into a new text file using a DOS batch.

Leave a Reply

 

 

 

You can use these HTML tags

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>

Bandwidth utilization bar