LinuxSir.cn,穿越时空的Linuxsir!

 找回密码
 注册
搜索
热搜: shell linux mysql
查看: 817|回复: 3

这个脚本我要按ctrl+c才能推出。

[复制链接]
发表于 2003-11-15 01:53:25 | 显示全部楼层 |阅读模式
# cat well
#!/bin/bash
while read /share/c/md5
do
cat $i|sed 's/00[0-9][0-9][0-9]//' >>ok
done
刚才用这个文件试了。怎么按cttl+c推出发现成功?
# cat tmp
00001 // MD5.CC - source code for the C++/object oriented translation and
00002 //          modification of MD5.
00003
00004 // Translation and modification (c) 1995 by Mordechai T. Abzug
00005
00006 // This translation/ modification is provided "as is," without express or
00007 // implied warranty of any kind.


我的要求是删去文件前面的数字。thanks in advance!!
发表于 2003-11-15 10:04:03 | 显示全部楼层
1,$i是什么? 它从哪里来?
2,要忽略CTRL+C这个信号吗?
3,是删除tmp文件里的//之前的文件名?
 楼主| 发表于 2003-11-15 11:29:30 | 显示全部楼层
抱歉,说的不明白,就是一大篇程序,前面有每一行的序号。我要去掉序号,结果要求这样:
// MD5.CC - source code for the C++/object oriented translation and
//          modification of MD5.
  
// Translation and modification (c) 1995 by Mordechai T. Abzug
  
// This translation/ modification is provided "as is," without express or
// implied warranty of any kind.
发表于 2003-11-15 17:01:06 | 显示全部楼层
就事论事,可以:
  1. awk -F"//" '{print "//",$2}' urfile
复制代码
而像你第一个问题说的,你的while 那段我感觉有些问题~~,(我没有实践),而对CTRL+C的控制,可以参考trap这个shell内建指令
您需要登录后才可以回帖 登录 | 注册

本版积分规则

快速回复 返回顶部 返回列表