<pre name="code" class="sql">v-test-app01:/root# cat split.pl 
open (LOG ,"<","1.out");
      while (<LOG>) {
      chomp;
      ##分隔符为空格,取第三列
      $var=(split(/\s+/,"$_"))[2];
      ##按:分隔,取第一列
      $ip =(split(/:/,"$var"))[0];
      print "\$var is $var\n";
      print "\$ip is $ip\n";
               };
v-test-app01:/root# cat 1.out 
a1   b1    c:1  d1
a2   b2    c:2  d2
a3   b3    c:3  d3
a4   b4    c:4  d4
v-test-app01:/root# perl split.pl 
$var is c:1
$ip is c
$var is c:2
$ip is c
$var is c:3
$ip is c
$var is c:4
$ip is c