Assignment 6 - string search and report

The string first and string range commands are sufficient for simple parsing and rearranging data.

string first str1 str2 Returns the index of the first occurance of str1 in str2, or -1 if no str1 in str2.
string range str start end Returns the characters in str between start and end

This code: set st1 "This is a test" set firstSpace [string first " " $st1] set testPos [string first "test" $st1] incr testPos -1 set middleWords [string range $st1 $firstSpace $testPos] puts "the middle is: '$middleWords'" displays:
the middle is: ' is a '

Download this output from a tcpdump program use the string first and string range commands to display only the IP addresses/ports and the amount of data being transfered.

The end of the output should resemble this:



 70.41.43.223.55664 > 69.63.178.111.80 : length 40 bytes
 70.41.43.223.2530 > 208.73.181.192.5223 : length 52 bytes
 208.73.181.192.5223 > 70.41.43.223.2530 : length 52 bytes
 70.41.43.223.2413 > 208.73.181.192.5223 : length 52 bytes
 208.73.181.192.5223 > 70.41.43.223.2413 : length 52 bytes
 70.41.43.223.3572 > 208.73.181.192.5223 : length 52 bytes
 208.73.181.192.5223 > 70.41.43.223.3572 : length 52 bytes
 99.196.174.1.67 > 255.255.255.255.68 : length 464 bytes