+ -
当前位置:首页 → 问答吧 → 求用perl求值问题

求用perl求值问题

时间:2010-12-03

来源:互联网

memory      1003520      981186       22334      292453     1011839

如何取到1003520和 22334 ? 谢谢

作者: rhshi   发布时间: 2010-12-03

别perl了
echo memory      1003520      981186       22334      292453     1011839|cut -f2,4 -d" "
1003520 22334

作者: 昭襄王   发布时间: 2010-12-03

perl的命令行不熟悉啊···

作者: wfnh   发布时间: 2010-12-03

回复 rhshi


     echo "memory      1003520      981186       22334      292453     1011839" |perl -ane 'print $F[1]," ",$F[3]'

作者: wtuter   发布时间: 2010-12-03

  1. $_ = "memory    1003520    981186      22334     292453    1011839";
  2. my @list = (split /\s+/)[1,3];
复制代码

作者: wxlfh   发布时间: 2010-12-03