awk 使用

来源:互联网 发布:淘宝的旗舰店可信吗 编辑:程序博客网 时间:2024/04/30 07:59

cat english_w06.txt  |awk  '{print $3}'    打印上述文档第三列的所有单词
awk '{for(i=1;i<=NF;++i) if($i=="some") ++sum}END{print sum}' english_w06.txt   统计单词some和 will出现的次数,并输出统计结果到文件
awk '{for(i=1;i<=NF;++i) if($i=="will") ++sum}END{print sum}' english_w06.txt

ifconfig | awk '/eth/{inter=$1;getline;sub(/inet addr:/,"");print inter,$1}' 使用ifconfig,显示网卡ip地址

english_w06.txt

Some people are a little nervous when it comes to cooking for someone else,
but even if you haven’t done much cooking, there are some delicious meals
you can prepare that will impress your date. The best part about cooking for
someone else is that it gives you an opportunity to serve the person you are
with, and that alone will start things off on a good note. The following are some
easy but delicious things you can cook on a date with someone new.

0 0
原创粉丝点击