sed command review
Command | What It Does |
---|---|
sed –n '/sentimental/p' filex | Prints to the screen all lines containing sentimental. The file filex does not change. Without the –n option, all lines with sentimental will be printed twice. |
sed '1,3d' filex > newfilex | Deletes lines 1, 2, and 3 from filex and saves changes in newfilex. |
sed '/[Dd]aniel/d' filex | Deletes lines containing Daniel or daniel. |
sed –n '15,20p' filex | Prints only lines 15 through 20. |
sed '1,10s/Montana/MT/g' filex | Substitutes Montana with MT globally in lines 1 through 10. |
sed '/March/!d' filex (csh) | Deletes all lines not containing March. (The backslash is used only in the csh to escape the history character.) |
sed '/report/s/5/8/' filex | Changes the first occurrence of 5 to 8 on all lines containing report. |
sed 's/....//' filex | Deletes the first four characters of each line. |
sed 's/...$//' filex | Deletes the last three characters of each line. |
sed '/east/,/west/s/North/South/' filex | For any lines falling in the range from east to west, substitutes North with South. |
sed –n '/Time off/w timefile' filex | Writes all lines containing Time off to the file timefile. |
sed 's/([Oo]ccur)ence/1rence/' file | Substitutes either Occurence or occurence with Occurrence or occurrence. |
sed –n 'l' filex | Prints all lines showing nonprinting characters as nn, where nn is the octal value of the character, and showing tabs as >. |
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/8730/viewspace-1034434/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- [review]Design Pattern:CommandView
- mac 執行sed -i指令時,總是出現extra characters at the end of commandMac
- 程式碼review工具:Review BoardView
- TopoSort ReviewView
- code ReviewView
- KR ReviewView
- java reviewJavaView
- sed用法
- WHY review code?View
- CF 977 ReviewView
- CF 979 ReviewView
- sed 應用
- linux之sedLinux
- LINUX命令-sedLinux
- Git Gerrit Code ReviewGitView
- OpenStack Git review 使用GitView
- Edu Round 170 ReviewView
- hot100 reviewView
- college2reviewView
- 關於code reviewView
- How to use “cat” command on “find” command's output?
- -bash: id: command not found -bash: tty: command not found
- command模式模式
- Linux sed命令用法Linux
- linux之 sed命令Linux
- sed用法點滴
- linux sed學習Linux
- sed 修改檔案
- sed命令小記
- code review的意義View
- BUU CODE REVIEW 1 1View
- Review: Red Star over ChinaView
- How to review diffs between commitsViewMIT
- Code Review最佳實踐View
- BUUCTF 基礎CODE REVIEWView
- 如何做好Code ReviewView
- nodemon: command not found
- Command Line Tools
- pip: command not found