Linux fold命令詳解 Linux fold命令怎麼用

來源:互聯網
上載者:User

fold指令會從指定的檔案裡讀取內容,將超過限定列寬的列加入增列字元後,輸出到標準輸出裝置。若不指定任何檔案名稱,或是所給予的檔案名稱為"-",則fold指令會從標準輸入裝置讀取資料。

文法

fold [-bs][-w<每列行數>][--help][--version][檔案...]

參數:

  • -b或--bytes 以Byte為單位計算資料行寬,而非採用行數編號為單位。
  • -s或--spaces 以空白字元作為換列點。
  • -w<每列行數>或--width<每列行數> 設定每列的最大行數。
  • --help 線上協助。
  • --version 顯示版本資訊。

執行個體

將一個名為testfile 的檔案的行摺疊成寬度為30,可使用如下命令:

fold -w 30 testfile

為了對比,先將testfile檔案輸出如下:

$ cat testfile #查看testfile 中的內容

Linux networks are becoming more and more common, but

security is often an overlooked

issue. Unfortunately, in today’s environment all networks

are potential hacker targets,

from top-secret military research networks to small home LANs.

Linux Network Security focuses on securing Linux in a

networked environment, where the

security of the entire network needs to be considered

rather than just isolated machines.

It uses a mix of theory and practical techniques to

teach administrators how to install and

use security applications, as well as how the

applications work and why they are necessary.

然後使用fold命令摺疊顯示:

$ fold -w 30 testfile #行摺疊成寬度為30,顯示testfile 檔案

Linux networks are becoming mo

re and more common, but securi

ty is often an overlooked issu

e. Unfortunately, in today’s

environment all networks are

potential hacker targets, from

top-secret military research

networks to small home LANs.

Linux Network Security focuses

on securing Linux in a networ

ked environment, where the sec

urity of the entire network ne

eds to be considered rather th

an just isolated machines. It

uses a mix of theory and pract

ical techniques to teach admin

istrators how to install and u

se security applications, as w

ell as how the applications wo

rk and why they are necessary

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.