`
whitesock
  • 浏览: 486022 次
  • 性别: Icon_minigender_1
  • 来自: 大连
社区版块
存档分类
最新评论

Several Frequently Used Commands

阅读更多

sed '/^\s*$/d' a.txt # delete ALL blank lines
sed '/./,$!d' a.txt # delete all leading blank lines at top of file

 

sed '=' a.txt | sed 'N;s/\n/\t/' # cat -n a.txt

sed '/./=' a.txt | sed '/./N; s/\n/\t/' # number each not blank line of file

 

sed '1!G;h;$!d' a.txt # reverse order of lines

sed '/./,$!d' a.txt # delete all leading blank lines at top of file

sed '$!N; /^\(.*\)\n\1$/!P; D' a.txt # delete duplicate, consecutive lines

 

gawk '$1~/[0-9].*/{total += $2} END{print total}' a.txt
gawk 'BEGIN {"cat c.txt | wc -l"|getline n} n>10 {print}' a.txt

ls | gawk -F. '{system("mv " $0 " " sprintf("%03d", $1) "." $2)}

 
分享到:
评论

相关推荐

    ANSYS SpaceClaim 2016 User Guide

    - **Keyboard Shortcuts**: Enhances productivity by enabling quick access to frequently used commands. - **Multitouch Screen Usage**: Supports touch gestures for navigating and manipulating designs, ...

    Manning.Git.in.Practice.2014.9.pdf

    - **Aliases**: Aliases can be defined to simplify frequently used commands. For example, `git config --global alias.co checkout` sets `co` as an alias for `checkout`. - **Editor Settings**: Git uses ...

    UE(官方下载)

    UltraEdit includes a Search and Replace Favorites feature that allows you to manage frequently used Find and Replace strings. Create, name, and edit your Search and Replace Favorites... Customizing ...

    微软内部资料-SQL性能优化5

     Describe the different types of indexes and how indexes can be used to improve performance.  Describe what statistics are used for and how they can help in optimizing query performance.  ...

    计算机网络第六版答案

    Acknowledgments: Over the years, several students and colleagues have helped us prepare this solutions manual. Special thanks goes to HongGang Zhang, Rakesh Kumar, Prithula Dhungel, and Vijay ...

Global site tag (gtag.js) - Google Analytics