韩半仙

  博客园  ::  :: 新随笔  ::  :: 订阅 订阅  :: 管理

2011年12月2日

摘要: 〇、前言 意见反馈,请mailto:datouwang...at...gmail.com。 一、AWK简介 AWK名字来源于三位创造者Aho、Weinberger和Kernighan统称。 AWK擅长处理文本数据。 二、AWK的调用方式 awk [-Ffs] [-v var=value] [program | -f progfile ...] [file ...] 1、命令行方式 例如: awk '{print $1}' file ps -ef|grep program|awk '{print $2}' 2、文件方式 ... 阅读全文
posted @ 2011-12-02 02:51 韩英武 阅读(275) 评论(0) 推荐(0)

摘要: open a file and return its number of lines.Version 1st:#!/usr/bin/perluse strict;use warnings;my $filename = "linesfile.txt"; # the name of the fileopen(FH, $filename); # open the filemy @lines = <FH>; # read the fileclose(FH); # close the filemy $count = scalar @lines; # the number 阅读全文
posted @ 2011-12-02 00:51 韩英武 阅读(210) 评论(0) 推荐(0)