sed -e 4a\newLine testfile
首先查看testfile中的內容以下:linux
$ cat testfile #查看testfile 中的內容 HELLO LINUX! Linux is a free unix-type opterating system. This is a linux testfile! Linux test
使用sed命令後,輸出結果以下:spa
$ sed -e 4a\newline testfile #使用sed 在第四行後添加新字符串 HELLO LINUX! #testfile文件原有的內容 Linux is a free unix-type opterating system. This is a linux testfile! Linux test newline