为生存而奔跑

   :: 首页 :: 联系 :: 聚合  :: 管理
  271 Posts :: 0 Stories :: 58 Comments :: 0 Trackbacks

留言簿(5)

我参与的团队

搜索

  •  

积分与排名

  • 积分 - 319332
  • 排名 - 75

最新评论

阅读排行榜

评论排行榜

cat 把档案串连接后传到标准输出

参数:
  -n 或 --number 由 1 开始对所有输出的行数编号
  -b 或 --number-nonblank 和 -n 相似,只不过对于空白行不编号
  -s 或 --squeeze-blank 当遇到有连续两行以上的空白行,就代换为一行的空白行
  -v 或 --show-nonprinting
  范例:
  cat -n textfile1 > textfile2 把 textfile1 的档案内容加上行号后输入 textfile2 这个档案里
  cat -b textfile1 textfile2 >> textfile3 把 textfile1 和 textfile2 的档案内容加上行号(空白行不加)之后将内容附加到 textfile3 里。
  
   范例:
  把 textfile1 的档案内容加上行号后输入 textfile2 这个档案里
   cat -n textfile1 > textfile2
  
  把 textfile1 和 textfile2 的档案内容加上行号(空白行不加)之后将内容附加到 textfile3 里。
   cat -b textfile1 textfile2 >> textfile3

   cat /dev/null > /etc/test.txt 此为清空/etc/test.txt档案内容


如果在命令行中直接输入cat,那么接下来,你输入什么,会立即显示什么,直到ctrl+D结束文件输入
cat > junk


posted on 2010-05-20 09:26 baby-fly 阅读(1436) 评论(0)  编辑 收藏 引用 所属分类: Ubuntu&Linux

只有注册用户登录后才能发表评论。
网站导航: 博客园   IT新闻   BlogJava   知识库   博问   管理