linux 中cat的用法

1.显示文件内容 直接 cat filename

  [root@bogon cat_test]# cat file2
  this is a test of cat
  this file's name is file2

2.显示文件内容,对非空白行编码 cat -b filenme 

  [root@bogon cat_test]# cat -b file1    

     1  this is for test of cat

     2  this filename is file1

     3  last line

3.对于比较大的文件,可以采用 cat filename |more

4.创建文件  cat >newfilename<<EOF

   [root@bogon cat_test]# cat >file5<<EOF
    > KNOWLEDGE IS POWER

  这个例子创建了一个file5的文件,并提示要写入的内容,直到遇到EOF(linux下面的EOF是通过ctrl+d输入的)。

5.向已有的文件中增加内容 cat  >>existingfile<<EOF

  [root@bogon cat_test]# cat>>file5<<EOF
  > this a new content added

同样EOF结束输入。

6.将几个文件联结输入到一个新文件 cat  filename1 filename2  >filename3

7.将几个文件联结追加到一个现有的文件中 cat filenam1 filename2 >>filename3

 

  

 

转载于:https://www.cnblogs.com/daqiang/archive/2013/04/12/3016902.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值