zoukankan      html  css  js  c++  java
  • Shell编程日常积累_20160114

    • cat命令 显示文件
    [root@ptadsv71g zsh]# cat fstab.s
    test1:2016
    
    test2:2017
    [root@ptadsv71g zsh]# cat fstac.s
    test1:2016
    
    test2:2018
    
    [root@ptadsv71g zsh]# cat *.s   #合并文件
    test1:2016
    
    test2:2017
    test1:2016
    
    test2:2018
    
    [root@ptadsv71g zsh]# cat *.s | sort  #合并和排序文件
    
    
    
    test1:2016
    test1:2016
    test2:2017
    test2:2018
    [root@ptadsv71g zsh]# cat *.s | sort | uniq  #合并和排序文件,留唯一行
    
    test1:2016
    test2:2017
    test2:2018
    [root@ptadsv71g zsh]# cat *.s | sort | uniq > test.txt  #合并和排序文件,留唯一行
    [root@ptadsv71g zsh]# cat test.txt
    
    test1:2016
    test2:2017
    test2:2018
    [root@ptadsv71g zsh]# cat /dev/null > test.txt  #清除文件内容
    [root@ptadsv71g zsh]# cat test.txt
    [root@ptadsv71g zsh]#
    • tr 替换字符
    [root@ptadsv71g zsh]# cat fstab.s
    test1:2016
    
    test2:2017
    [root@ptadsv71g zsh]# tr 2 3 < fstab.s   #23
    test1:3016
    
    test3:3017
    [root@ptadsv71g zsh]# tr 'a-z' 'A-Z' < fstab.s   #小写 ⇒ 大写
    TEST1:2016
    
    TEST2:2017
    [root@ptadsv71g zsh]# tr 'a-z' 'A-Z' < fstab.s >test.txt  #小写 ⇒ 大写
    [root@ptadsv71g zsh]# cat test.txt
    TEST1:2016
    
    TEST2:2017
    [root@ptadsv71g zsh]#

    未完待续

  • 相关阅读:
    python学习笔记
    win10优化设置
    jpa基本用法
    5_方法(函数)、参数传递
    12_文件基本权限
    10_管理用户和组
    9_用户和组的相关配置文件
    7_vim 编辑器使用技巧
    8_Xmanager 远程连接 Linux 系统工具使用方法
    5_Linux系统目录结构,相对/绝对路径
  • 原文地址:https://www.cnblogs.com/SilverBullet/p/5130282.html
Copyright © 2011-2022 走看看