- Parameter
- -n : 不要在最後自動換行
- -e : 若字串中出現以下字元, 則特別加已處理, 而不將之當成一般文字輸出.
- \a : 發出警告聲
- \n : 刪除前一個字元
- \c : 最後不加上換行符號
- \f : 換行且游標停留在原來位置
- \n : 換行且游標移至行首
- \r : 游標移至行首, 但不換行
- \t : 插入 tab
- \v : 與 \f 相同
- \\ : 插入 \ 字元
- \nnn : 插入 nnn (八進位) 所代表的 ASCII字元
Example
原有文件: test.file
文件內容:
原有文件: test.file
文件內容:
- this is line 1 on original test.file!
- this is line 2 on original test.file!!
- this is line 3 on original test.file!!!
- 文件已有文字, 新增一行在文件最後.
- # echo "add one more line" >> test.file
- # cat test.file
- this is line 1 on original test.file!
- this is line 2 on original test.file!!
- this is line 3 on original test.file!!!
- add one more line
- 新增兩行指令在script file最後面.
- # echo -e "sleep 2\n./mnt/usb/sample_uarttest" >> test.sh
- # cat test.sh
- this is line 1 on original test.file!
- this is line 2 on original test.file!!
- this is line 3 on original test.file!!!
- sleep 2
- ./mnt/usb/sample_uarttest
- 新增 tmp.file 的內容至 test.file 後面.
- tmp.file content:
- there is line A on tmp.file~
- there is line B on tmp.file~~
- there is line C on tmp.file~~~
- # cat tmp.file >> test.file
- # cat test.file
- this is line 1 on original test.file!
- this is line 2 on original test.file!!
- this is line 3 on original test.file!!!
- there is line A on tmp.file~
- there is line B on tmp.file~~
- there is line C on tmp.file~~~
- 在 test.file 內容和 tmp.file 內容中間加入一行 Hello World!!!
- # echo "Hello World!!!" | cat - tmp.file >> test.file
- # cat test.file
- this is line 1 on original test.file!
- this is line 2 on original test.file!!
- this is line 3 on original test.file!!!
- Hello World!!!
- there is line A on tmp.file~
- there is line B on tmp.file~~
- there is line C on tmp.file~~~
沒有留言:
張貼留言