i have the following file part:
0000 00 14 a8 ff 32 24 00 18 18 8f a6 8e 08 00 45 88 ....2$........E.
0010 00 83 eb 36 00 00 40 11 63 6b ac 14 e9 ae ac 14 ...6..@.ck......
0020 e9 68 40 00 40 00 00 6f 0f 81 80 60 00 7a 00 00 .h@.@..o...`.z..
0030 e4 c0 71 72 0a 32 00 10 02 b8 09 00 75 65 86 31 ..qr.2......ue.1
0040 74 48 1d 23 e3 ce fa 92 a4 dd a1 2a a2 9d b9 55 tH.#.......*...U
0050 2a 86 64 e4 ce 1d b2 a9 3a 4a 92 de d1 94 81 ad *.d.....:J......
0060 17 2a 67 d6 d5 66 7d 0c 6f a5 9d 4e 55 8d fa 8c .*g..f}.o..NU...
0070 14 e9 61 a3 68 92 16 36 bf ad 19 d8 6e 3e 91 22 ..a.h..6....n>."
0080 4d 86 70 18 f3 c5 72 92 1b b2 f2 30 8e 3a 3c 76 M.p...r....0.:<v
0090 20
i am using the following code on it (trimStr is ofcourse a line from the above):
Code: Select all
if {[regexp -- {^\w+\s\s((\w+\s){1,16}).*$} $trimStr matchStr binaryLine]} {
# Skipping headers
if {[llength $binaryLine] < $newByteSkip} {
set newByteSkip [expr $newByteSkip - [llength $binaryLine]]
continue
} elseif {$newByteSkip > 0} {
# skipping last part of headers and printing raw data
# including the first part of rtp header
#removing the last of the unrelevant header bytes.
set binaryLine [lreplace $binaryLine 0 [expr $newByteSkip - 1]]
# getting length of the rest of the line
set len [llength $binaryLine]
# setting size
set line [binary format s $Size]
append line [eval "binary format [string repeat "H2" $len] $binaryLine"]
set newByteSkip 0
set rtpHdrSkip [expr $rtpHdrSkip - $len]
puts -nonewline $outFileBinNew $line
} elseif {$rtpHdrSkip > 0} {
# Printing the second part of the rtp header
# and printing the raw data to new format
set len [llength $binaryLine]
# checking if last line
if { $len < 16 } {
set mode $PL_MODE
}
set line [ eval "binary format [string repeat "H2" $rtpHdrSkip] $binaryLine"]
puts -nonewline $outFileBinNew $line
# Skipping the rest of the rtp header and printing raw data
set binaryLine [lreplace $binaryLine 0 [expr $rtpHdrSkip - 1]]
# from here printing the rest of the payload to both new and old files
set len [llength $binaryLine]
if {$len > $payloadLen} {
set len $payloadLen
} else {
set payloadLen [expr $payloadLen - $len]
}
if {$len == 0} {
set mode $PL_MODE
continue
}
set line [ eval "binary format [string repeat "H2" $len] $binaryLine"]
puts -nonewline $outFileBinOld $line
puts -nonewline $outFileBinNew $line
set rtpHdrSkip 0
} else {
# print raw data
set len [llength $binaryLine]
if {$len > $payloadLen} {
set len $payloadLen
} else {
set payloadLen [expr $payloadLen - $len]
}
if {$len == 0} {
set mode $PL_MODE
continue
}
set line [ eval "binary format [string repeat "H2" $len] $binaryLine"]
puts -nonewline $outFileBinNew $line
puts -nonewline $outFileBinOld $line
if { $len < 16 } {
set mode $PL_MODE
}
}
} elseif {[regexp -- {^Frame.*bytes\scaptured\)$} $trimStr]} {
set mode $PL_MODE
} else {
continue
}
invalid command name "0"
while executing
"0"
("while" body line 204)
invoked from within
"while {[gets $inFile readBuff] !=
incr progBar
if {$progBar == 100} {
set progBar 0
puts -nonewline ".
flush stdout
}
set trimStr ..."
(file "ether2mf.tcl" line 136)
Help please!!!