每个文件的这些关键字是不是这出现在某一行?
for data in $(ls *.dat)
do
tocell=$grep "Total Cells:" $data|awk -F":" "{print $2 }"} #可以这样提取 也可以用cut之类的 cut -d: -f2
...
...
done
另外也可以用sed来提取你要的数据
反正完成一个任务有很多种选择的。
如果觉得麻烦还可以学一下perl。 不知道是不是你要的
#!/usr/bin/bash
total_cell=`sed -n -e "s/Total Cells://p" *.dat`
trans_cell=`sed -n -e "s/Transported Cells://p" *.dat`
throughput=`sed -n -e "s/Throughput://p" *.dat`
total_accept=`sed -n -e "s/Total Accepted Cells://p" *.dat`
echo ${total_cell} ${trans_cell} ${throughput} ${total_accept} Linux CP 复制不提示的解决方法Linux下用adb连接手机的问题解决相关资讯 Linux教程
- Linux教程:如何在命令行中查看目 (07/28/2014 12:22:23)
- Linux 修改root密码 (11/03/2012 07:53:38)
- su - root 与su root的区别 (06/06/2012 00:39:40)
| - Linux进程间通信:消息队列 (01/28/2013 09:43:00)
- U盘安装Linux开机无法启动解决方法 (10/07/2012 08:55:52)
- Windows 7/Linux 同步时间 (05/15/2012 06:17:55)
|
本文评论 查看全部评论 (0)