找回密码
 注册
关于网站域名变更的通知
查看: 380|回复: 3
打印 上一主题 下一主题

Linux fold命令

[复制链接]

该用户从未签到

跳转到指定楼层
1#
发表于 2021-9-23 09:55 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式

EDA365欢迎您登录!

您需要 登录 才可以下载或查看,没有帐号?注册

x

( s) g0 ]+ ?4 \6 YLinux fold命令用于限制文件列宽。
) M9 `3 Y/ K0 l7 ~
% Z& q7 Q2 v3 Z6 H8 V+ {2 i4 xfold指令会从指定的文件里读取内容,将超过限定列宽的列加入增列字符后,输出到标准输出设备。若不指定任何文件名称,或是所给予的文件名为"-",则fold指令会从标准输入设备读取数据。) j& _) t7 i' X" V

& R/ b. A; d( E& w+ e- [
; A7 X8 ?' n1 r语法
# h1 l6 v8 }% ^+ ~# y# J7 ^+ l2 }+ G4 _& P( X1 M1 R4 D! y- X
fold [-bs][-w<每列行数>][--help][--version][文件...]6 }  _2 ^1 O9 B) @2 H% R. {
( i) K) U5 C9 |7 }' o3 n  S* z

% s) `1 @0 h7 K) I5 @. ^' p" t. w1 C8 ~  v" n
参数:  ~" x1 q8 s2 `( D: S9 G
9 ?6 X9 K# H( j. U* Y# m; z! A
-b或--bytes 以Byte为单位计算列宽,而非采用行数编号为单位。
: Y3 j! d1 I& u" c7 g-s或--spaces 以空格字符作为换列点。
& b/ T9 N" L' N) S$ ?8 ~# U" _-w<每列行数>或--width<每列行数> 设置每列的最大行数。4 S- q% X5 }5 d4 R( l* h
--help 在线帮助。
0 O! T; J5 W  M/ l--version 显示版本信息。4 G8 m) I. I% N0 b9 `
$ c! g' V6 q7 i6 o* H
' S* m2 e9 J9 q3 c

2 N4 x( M5 H; M( A: N! y2 v实例
, Q0 \4 e. w4 n& ~$ T' {) x/ a) j* k/ s# N. @7 g' [4 ]; O5 r
将一个名为testfile 的文件的行折叠成宽度为30,可使用如下命令:) w; N3 }( a  S
( p& N. u( Z' z" T, O& M
fold -w 30 testfile
% u5 B: |7 c" e; I0 H# Q
4 a5 M. c9 k, r( w* _# o! L/ A2 u( O' T- y) O6 O. p. I
为了对比,先将testfile文件输出如下:
) ~9 q# R" X  ]; j( n
& W3 [9 L4 ]$ Y3 ?+ k- H$ cat testfile #查看testfile 中的内容  : N& C5 Q, \0 u
Linux networks are becoming more and more common, but
: J5 K3 I7 Z) h+ fsecurity is often an overlooked  
6 ]4 J0 i9 m! e) X* O) i) |6 Bissue. Unfortunately, in today’s environment all networks + M, B/ Y' ]7 B$ r+ O' [
are potential hacker targets,  
+ b5 S$ }4 _/ ^from top-secret military research networks to small home LANs.  
1 b( x: I. e' |7 G! q7 `8 R3 hLinux Network Security focuses on securing Linux in a 6 E( M! Y6 K' Q2 D! O8 ^
networked environment, where the  
$ [' D; o- O2 v" {: ]3 msecurity of the entire network needs to be considered
1 ?; Z; e- O% q4 u1 D9 {" t2 I8 Vrather than just isolated machines.  2 U# b/ c+ {1 d+ x6 ~8 s5 @
It uses a mix of theory and practical techniques to 1 f, \% ?, T$ c
teach administrators how to install and  0 `) Y% O) s0 J# c  `7 o1 @6 a, f
use security applications, as well as how the
. i% O, x4 N3 g/ W. ^applications work and why they are necessary. % T) [, G/ W8 d  u3 z; m+ R, L- _

# j  E( b* Y' @: ?( `& W% ^7 m$ ~! L! Y) v
然后使用fold命令折叠显示:
  ]1 r* Q- r" H$ ?$ S$ N$ m9 K/ D* E. H! |
$ fold -w 30 testfile #行折叠成宽度为30,显示testfile 文件  ; E- q& h$ m, e$ U: P% Z0 `( P
Linux networks are becoming mo  
, P; s1 }" h4 ~' N- zre and more common, but securi  
* R. y7 O; ]* h) P6 A5 g" |ty is often an overlooked issu  & Z7 g+ i9 i/ z% |; [) r. _' y4 Q. s
e. Unfortunately, in today’s  , @9 [" Q3 W4 n3 l+ r) X
environment all networks are  
3 `$ A2 C! j) N0 Q# P( G  P2 n! S) R* Wpotential hacker targets, from  / E- [6 e! ?: |
top-secret military research  3 @6 ~3 l- J( ^2 b0 Q5 G3 y& r0 x
networks to small home LANs.  * l0 R- L5 l) v: t
Linux Network Security focuses  
+ b# A1 P, Z/ _* A7 L- `( don securing Linux in a networ  
. }! b. g! @' [0 x* V5 uked environment, where the sec  
& M+ g( p5 N3 X' B' D9 y) W$ Purity of the entire network ne  " `9 s: K6 a# r! O! j; n
eds to be considered rather th  
2 T: E) C, `& Q6 jan just isolated machines. It  + M: ]* I8 L1 {3 E8 A
uses a mix of theory and pract    l4 |* O3 O4 ~% k
ical techniques to teach admin  $ b+ [+ Y, V2 `8 d: s2 `' q
istrators how to install and u  # |- X# ]1 i  U" R0 Q& ^
se security applications, as w  
7 r2 _8 o! H/ Cell as how the applications wo  8 w4 `1 r/ ]9 t" P
rk and why they are necessary
% s9 r0 ?; c5 R$ t( W. I

该用户从未签到

2#
发表于 2021-9-23 13:25 | 只看该作者
Linux fold命令
  • TA的每日心情

    2019-11-29 15:37
  • 签到天数: 1 天

    [LV.1]初来乍到

    3#
    发表于 2021-9-23 13:25 | 只看该作者
    Linux fold命令用于限制文件列宽

    该用户从未签到

    4#
    发表于 2021-9-23 13:26 | 只看该作者
    fold指令会从指定的文件里读取内容,将超过限定列宽的列加入增列字符后,输出到标准输出设备
    您需要登录后才可以回帖 登录 | 注册

    本版积分规则

    关闭

    推荐内容上一条 /1 下一条

    EDA365公众号

    关于我们|手机版|EDA365电子论坛网 ( 粤ICP备18020198号-1 )

    GMT+8, 2025-6-21 13:35 , Processed in 0.078125 second(s), 23 queries , Gzip On.

    深圳市墨知创新科技有限公司

    地址:深圳市南山区科技生态园2栋A座805 电话:19926409050

    快速回复 返回顶部 返回列表