EDA365电子论坛网

标题: Linux fold命令 [打印本页]

作者: mytomorrow    时间: 2021-9-23 09:55
标题: Linux fold命令
, I; o$ v4 {7 b/ E6 M( D
Linux fold命令用于限制文件列宽。
& \% L* N6 S5 [$ f
0 L/ e- D. Y9 ^3 m1 s) {' cfold指令会从指定的文件里读取内容,将超过限定列宽的列加入增列字符后,输出到标准输出设备。若不指定任何文件名称,或是所给予的文件名为"-",则fold指令会从标准输入设备读取数据。
1 D3 a. J* D* i: @5 [3 P# y1 z; E6 W+ u. X) T7 K
1 |8 e0 Z$ X9 B! }/ [
语法2 B8 x# y4 S/ l2 Q  e

) R* X3 O1 S3 v  e5 X1 S0 A% Nfold [-bs][-w<每列行数>][--help][--version][文件...]
9 n8 d0 F5 ~" M3 O) N3 n& X2 J1 o# g; M  P+ U; n- a: N9 i1 O
/ X6 v  v  k* V& g; w( G
1 e" F* ?7 m8 ]* b( v# T; m, ^
参数:2 |$ |; L; S4 m1 W5 n
- K( V! I: S4 M- ?2 L) M& s/ q
-b或--bytes 以Byte为单位计算列宽,而非采用行数编号为单位。
0 w. J3 p" t' N$ ^-s或--spaces 以空格字符作为换列点。. G; O% R2 w# x1 {
-w<每列行数>或--width<每列行数> 设置每列的最大行数。
# M8 x4 @% N5 t) s# |--help 在线帮助。, [" \3 H) F" ~& q& ~( z) b
--version 显示版本信息。; ~( h2 B+ N1 U. q2 Z
6 h" O1 a+ D+ e2 }/ _' p0 l
; f1 i  w# O0 e( ?0 D

" O" \# F9 C% m9 o9 I实例) e& `$ b. n1 [  W; k1 K  q

( f0 w$ x; _; g0 ]+ Y将一个名为testfile 的文件的行折叠成宽度为30,可使用如下命令:: [* |( Y  a; R' T1 b+ K

4 V1 T  M2 ^3 h% ?fold -w 30 testfile3 x! t. d# r7 r. X. H. F2 }

8 V9 f+ W9 ~  q9 G( M5 B
6 q% M8 h4 m0 J& p7 y( m为了对比,先将testfile文件输出如下:" g9 q) @* p8 i$ t+ }

7 ~  {! _( O/ d: Y( q2 r$ cat testfile #查看testfile 中的内容  ' `+ ]/ v: W% r$ |9 ~3 q. v3 g
Linux networks are becoming more and more common, but
: U! A. V; P+ S0 qsecurity is often an overlooked  7 `' s; C5 F* p" f5 O5 i$ N+ ^
issue. Unfortunately, in today’s environment all networks 6 O8 |/ ?7 ]% g& H
are potential hacker targets,  
7 ]4 P5 D% `. mfrom top-secret military research networks to small home LANs.    b7 q* W7 w) w! ~
Linux Network Security focuses on securing Linux in a
& K# j/ L  N6 t: r, X, U: g' qnetworked environment, where the  
  }3 h" h  ~3 c0 osecurity of the entire network needs to be considered 4 m$ C* j, d+ h
rather than just isolated machines.  
$ D7 x9 A- ?( {2 zIt uses a mix of theory and practical techniques to
0 F- p" `4 j5 S0 I, I! Cteach administrators how to install and  
6 e! Q' S" \, ^2 T1 s: }use security applications, as well as how the
2 w" B& }  z6 h# t  \applications work and why they are necessary.
% ~- }! }/ W5 `0 @+ j: u- X/ q* J! t: y# q8 s
* E6 b$ A. x& S  S* f! a
然后使用fold命令折叠显示:# M+ H# E% g0 f
, r3 A/ Z, B8 j9 j* M, |9 [
$ fold -w 30 testfile #行折叠成宽度为30,显示testfile 文件  
9 G, T: v9 e9 z7 m! ?+ [Linux networks are becoming mo  % M  F: S, z. h
re and more common, but securi  / M5 F  T2 Y8 C: n' m/ }% U8 R
ty is often an overlooked issu  ( Q7 Q8 ~/ f) I$ H
e. Unfortunately, in today’s  
9 L# {1 \& S; Fenvironment all networks are  
4 a7 s" O$ n% {9 l# q( Tpotential hacker targets, from  
: H1 n- L7 ?" o8 Q' \& ~9 l3 i3 k; \! Dtop-secret military research  $ F& `2 w  N. u; f
networks to small home LANs.  
7 T( \: r% q! m& d' W# XLinux Network Security focuses  
0 l+ O1 H, \4 m3 u2 q" V3 R' Y9 z5 kon securing Linux in a networ  # s$ q7 u8 Y5 j: N
ked environment, where the sec  0 `; z8 H" d* P
urity of the entire network ne  , N0 H3 v6 J5 ]& w
eds to be considered rather th  ' N( S8 A  M5 E  D0 ?7 H/ I
an just isolated machines. It  
8 W" r* E# m* D: a- _4 wuses a mix of theory and pract  % V2 k; V9 @; }
ical techniques to teach admin  0 u& e) i! _0 f0 l2 ?5 t: R- m
istrators how to install and u  
5 ~! S( t) r' Gse security applications, as w  
; P5 ^8 A8 J; q! x% j( _ell as how the applications wo  
( r; o# b) V* }  i4 \2 u# ?, `rk and why they are necessary , V5 ?8 J! `' u5 {( x

作者: AustCor1    时间: 2021-9-23 13:25
Linux fold命令
作者: yin123    时间: 2021-9-23 13:25
Linux fold命令用于限制文件列宽
作者: regngfpcb    时间: 2021-9-23 13:26
fold指令会从指定的文件里读取内容,将超过限定列宽的列加入增列字符后,输出到标准输出设备




欢迎光临 EDA365电子论坛网 (https://bbs.eda365.com/) Powered by Discuz! X3.2