Sign in to follow this  
Followers 0
vinhqct

Build an database from Notepad files

4 posts in this topic

Hello All,

I usually use excell to process my CDR files which are formatted in notepad. But I got a problem that when I need to process with a lot of CDR files, It took me so long and also make me crazy with them. So, anyone can help me build database from notepad files and just query data that I need to find ?

many thanks

Share this post


Link to post
Share on other sites



No problem but you need to be way more explicit about what you need exactly.

Which data are in the files (are they Corel Draw ???), what do you want to query?, Etc.


This wonderful site allows debugging and testing regular expressions (many flavors available). An absolute must have in your bookmarks.
Another excellent RegExp tutorial. Don't forget downloading your copy of up-to-date pcretest.exe and pcregrep.exe here
RegExp tutorial: enough to get started
PCRE v8.33 regexp documentation latest available release and currently implemented in AutoIt beta.

SQLitespeed is another feature-rich premier SQLite manager (includes import/export). Well worth a try.
SQLite Expert (freeware Personal Edition or payware Pro version) is a very useful SQLite database manager.
An excellent eBook covering almost every aspect of SQLite3: a must-read for anyone doing serious work.
SQL tutorial (covers "generic" SQL, but most of it applies to SQLite as well)
A work-in-progress SQLite3 tutorial. Don't miss other LxyzTHW pages!
SQLite official website with full documentation (may be newer than the SQLite library that comes standard with AutoIt)

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

Actually, That is text file. and I would like to build them by some of columns in a table. Then, I could query some of data I want. Let me show you something in that file. I don't know how to attach a file and help you easier to understand

UMTSGSMPLMNCallDataRecord

mSOriginatingSMSinMSC

dateForStartOfCharge 0C0308'H

exchangeIdentity "HCMS01 021/63/1"'S

recordSequenceNumber 9194679'D

timeForStartOfCharge 4 41 17'BCD

switchIdentity 0001'H

callIdentificationNumber 180706'D

chargedParty 00'H

callingSubscriberIMSI 452070008425730F'TBCD

firstCallingLocationInformation 54F270132527CF'H

teleServiceCode 22'H

tAC 030209'H

typeOfCallingSubscriber 1'D

callingSubscriberIMEI 356648047417600F'TBCD

incomingRoute "CBS011I"'S

originForCharging 00'H

callingPartyNumber 1184993177038F'TBCD

frequencyBandSupported 06'H

mSCIdentification 11841996604001'TBCD

serviceCentreAddress 11841998440000'TBCD

messageReference 8F'H

messageTypeIndicator 04'H

destinationAddress 120996870641'TBCD

UMTSGSMPLMNCallDataRecord

transit

callPosition 03'H

chargeableDuration 0 0 11'BCD

dateForStartOfCharge 0C0308'H

exchangeIdentity "HCMS01 021/63/1"'S

interruptionTime 0 0 0'BCD

recordSequenceNumber 9194680'D

tariffClass 1'D

tariffSwitchInd 00'H

timeForStartOfCharge 4 41 5'BCD

timeForStopOfCharge 4 41 17'BCD

switchIdentity 0001'H

typeOfCallingSubscriber 1'D

translatedNumber 140932791300'TBCD

tAC 000201'H

timeFromRegisterSeizureToStartOfCharging 0 0 12'BCD

subscriptionType 00'H

redirectionCounter 00'H

originatedCode 02'H

originForCharging 00'H

networkCallReference 5AC6490001'H

outgoingRoute "VMS211O"'S

incomingRoute "HCMS03I"'S

chargedParty 00'H

callingPartyNumber 14993216946F'TBCD

calledPartyNumber 120932791300'TBCD

eosInfo 00'H

callIdentificationNumber 180463'D

internalCauseAndLoc 0003'H

faultCode 0E97'H

disconnectingParty 01'H

Edited by vinhqct

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

#include <File.au3>
#include <Array.au3>
#include <String.au3>

Local $FileList = _FileListToArray(@ScriptDir, '*.cdr', 1)
If @error Then
    MsgBox(0, "", "No Filess Found.")
    Exit
EndIf

;~ _ArrayDisplay($FileList, "$FileList")

For $i = 1 To $FileList[0]
    ConsoleWrite($FileList[$i] & @CRLF)
    ProcessCDRFile($FileList[$i])
Next

Func ProcessCDRFile($file_name)
    $data = FileRead(@ScriptDir & '' & $file_name)
    $result = _StringBetween($data, 'switchIdentity', @CRLF] ;, -1, 0)
    If not @error Then ConsoleWrite('  switchIdentity: ' & $result[0] & @CRLF)
EndFunc

Edited by Zedna

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0