linux fmt編排文字檔案

2021-04-19 00:52:21 字數 572 閱讀 4747

指令名稱:fmt(fromat)

功能介紹:fmt指令會從指定的檔案裡讀取內容,將其依照指定格式重新編排後,輸出到標準輸出裝置。若指定的檔名為"-",則fmt指令會從標準輸入裝置讀取資料。

語法格式:

fmt [-cstu][-p《列起始字串》][-w《每列字元數》][--help][--version][檔案...]

常用引數說明:

-c或--crown-margin   每段前兩列縮排。

-p《列起始字串》或-prefix=《列起始字串》   僅合併含有指定字串的列,通常運用在程式語言的註解方面。

-s或--split-only   只拆開字數超出每列字元數的列,但不合併字數不足每列字元數的列。

-t或--tagged-paragraph   每列前兩列縮排,但第1列和第2列的縮排格式不同。

-u或--uniform-spacing   每個字元之間都以乙個空格字元間隔,每個句子之間則兩個空格字元分隔。

-w 《每列字元數》 或 --width = 《每列字元數》或-《每列字元數》   設定每列的最大字元數。

--version   顯示版本資訊。

讀取文字檔案

void ctestdlg onreadinfo cfile filewrite1 testwrite1.txt cfile modecreate cfile modewrite cfile filewrite2 testwrite2.txt cfile modecreate cfile modew...

寫文字檔案

textoper 文字檔案操作類 public class textoper 新建乙個檔案 public bool createfile string strpath,string strname else file.create strpath strname return true catch ...

文字檔案操作

1 文字檔案的寫入 建立檔案流 filestream filestream new filestream c myfile file.txt filemode.create 建立寫入器 streamwriter sw new streamwriter filestream 以流的方式寫入資料 sw....