【发布时间】:2013-08-14 23:59:45
【问题描述】:
我有一个问题,从 txt 文件中逐个字符地读取并进行更改是否更好。或者最好将txt文件转换为xml,然后在文件中进行更改? 我有txt文件:
Record: 1
{
choice = mobileToMobile:{
subscriberServicesIndicator = 09,
callIdentificationNumber = 70 CD BE,
recordSequenceNumber = 40 63 0F,
typeOfCallingSubscriber = 01,
callingPartyNumber = 41 27 27 19 66 91, -> needs to be changed to 41 72 72 91 66 19
calledPartyNumber = 31 27 37 72 73 10, -> needs to be changed to 31 72 73 27 37 10
disconnectingParty = callingPartyRelease,
dateForStartofCharging = 14 0C 01 1F, -> change from hexadecimal to decimal number
timeForStartofCharging = 0A 35 00, -> ...
timeForStopofCharging = 0A 38 1D, ->
chargeableDuration = 00 03 1E,
interruptionTime = 00 00 00,
timeFromRegisterSeizureToStartOfCharging = 00 00 07,
calledSubscriberInitialServingCellID = 02 06 33,
originForCharging = 00,
}
}
Record: 2
{
...... so on
}
【问题讨论】:
-
XML 很少能解决任何问题,除了“我如何获取需要 XML 的东西的信息?”因为它增加了复杂性而没有提供太多的灵活性。 awk 或 Perl 可以快速解决您显示的问题。
标签: xml file converter txt2tags