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
- sed: 1: “…”: invalid command code on Mac OSMac
- mac 執行sed -i指令時,總是出現extra characters at the end of commandMac
- 程式碼review工具:Review BoardView
- code ReviewView
- TopoSort ReviewView
- KR ReviewView
- sed 工具
- WHY review code?View
- CF 979 ReviewView
- 文字處理的金剛鑽 —— sed (GNU/sed)
- Git Gerrit Code ReviewGitView
- OpenStack Git review 使用GitView
- 關於code reviewView
- Java review--集合JavaView
- Java review--NIOJavaView
- Java review--IOJavaView
- Java review--反射JavaView反射
- CF 977 ReviewView
- Edu Round 170 ReviewView
- college2reviewView
- sed 應用
- code review的意義View
- BUUCTF 基礎CODE REVIEWView
- 如何做好Code ReviewView
- Code Review最佳實踐View
- final review 報告View
- Code Review Engine LearningView
- Book Review 《構建之法》View
- 什麼是Code ReviewView
- hot100 reviewView
- BUU CODE REVIEW 1 1View
- sed命令小記
- sed 修改檔案
- linux sed 命令Linux
- sed 字串替換字串
- sed用法總結
- sed 命令專題