Three easy ways to do it, which would be best depends on what you need to do with the data.
Option #1 – Full control:
set split_data [split $data $seg_delim]
set index 0
set seg_index_list {}
foreach segs $split_data {
if [cequal $seg [crange $segs 0 2]] {
lappend seg_index_list $index
}
incr index
}
set in1Count [llength $seg_index_list]
Option #2 – Count plus the IN1 segment data:
set split_data [split $data $seg_delim]
set in1Segs [lmatch $splitData “IN1*”]
set in1Count [llength $in1Segs]
Option #3 – Just a count: (there may be a better regexp but this should work)
set in1Count [regexp -all {rIN1|} $data]