Linux fold-Befehl
Der Linux-Befehl fold wird verwendet, um die Spaltenbreite von Dateien zu begrenzen.
Der Befehl fold liest Inhalte aus der angegebenen Datei, fügt Umbruchzeichen zu Spalten hinzu, die die begrenzte Spaltenbreite überschreiten, und gibt sie auf dem Standardausgabegerät aus. Wenn kein Dateiname angegeben wird oder wenn der angegebene Dateiname "-" ist, liest der Befehl fold Daten von der Standardeingabe.
Syntax
fold [-bs][-w<每列行数>][--help][--version][文件...]
Parameters:
- -b oder --bytes Berechnet die Spaltenbreite in Bytes, anstatt die Zeilenanzahl als Einheit zu verwenden.
- -s oder --spaces Verwendet Leerzeichen als Spaltenumbruchpunkte.
- -w<Anzahl der Zeichen pro Zeile> oder --width<Anzahl der Zeichen pro Zeile> Legt die maximale Zeilenbreite fest.
- --help Online-Hilfe.
- --version Zeigt Versionsinformationen an.
Beispiele
Um die Zeilen einer Datei namens testfile auf eine Breite von 30 umzubrechen, können Sie den folgenden Befehl verwenden:
fold -w 30 testfile
Zum Vergleich geben Sie die Datei testfile zunächst wie folgt aus:
$ 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.
Verwenden Sie dann den Befehl fold, um sie umzubrechen und anzuzeigen:
$ 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 necessaryAndere Erweiterungen
Linux-Befehlsenzyklopädie