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]#

    未完待续

  • 相关阅读:
    js验证邮箱
    输出一个金字塔
    仿QQ聊天软件2.0版
    zoj 3662 第37届ACM/ICPC长春赛区H题(DP)
    zoj 3659 第37届ACM/ICPC 长春赛区现场赛E题 (并查集)
    zoj 3640 概率dp
    hdu 5203 && BC Round #37 1002
    poj 3071 概率dp
    poj 2151 概率dp
    zoj 3460 二分+二分图匹配
  • 原文地址:https://www.cnblogs.com/SilverBullet/p/5130282.html
Copyright © 2011-2022 走看看