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

Linux fold命令

[复制链接]

该用户从未签到

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

EDA365欢迎您登录!

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

x
4 }% U8 q- P. [! X1 K6 r, p+ V
Linux fold命令用于限制文件列宽。/ W8 T1 g& q) T( L! I* P
/ F1 s! N2 Z7 f% C
fold指令会从指定的文件里读取内容,将超过限定列宽的列加入增列字符后,输出到标准输出设备。若不指定任何文件名称,或是所给予的文件名为"-",则fold指令会从标准输入设备读取数据。
0 T& w1 o; w  _
0 {# w% C, h/ ]. ]' H7 N; i
8 j2 h$ H! O6 A' H语法( |- C9 z' v& J2 K2 O. O( E2 {

- C  _8 S% X) z) Lfold [-bs][-w<每列行数>][--help][--version][文件...]
" K% }; \. z* Y* |1 M1 i: R1 V: O/ x* g& V* a: i
& t: P4 o1 w: c
" n  Y0 o; Q. y% T
参数:+ b9 X/ u' f+ q3 K1 r$ C
7 I( o" u# B6 |/ M
-b或--bytes 以Byte为单位计算列宽,而非采用行数编号为单位。
* f+ Z8 U' b% ]" @: P& }3 ]-s或--spaces 以空格字符作为换列点。
' l% X8 b& `. F-w<每列行数>或--width<每列行数> 设置每列的最大行数。3 i+ {( ^$ Q/ O/ `5 A
--help 在线帮助。
) q2 J' b7 g- f--version 显示版本信息。
- h- m2 K, w1 {' l, i
' q1 A! s4 R4 o3 g$ z1 Q  _  u+ k1 m9 k! @3 J. x" e( P) r

3 a0 w( z0 Y  J1 G实例3 P/ H& a4 m/ d8 F, x' m" y* n
* g- c: r7 }0 U3 i6 w" T2 {
将一个名为testfile 的文件的行折叠成宽度为30,可使用如下命令:
+ o) ^) y% V$ Z8 A7 [; `& `( W
fold -w 30 testfile
1 f3 y* D& P/ g5 A6 Z2 i2 e7 q" ^
+ j. I( a8 `; ^6 c* e$ ]" `
6 {; s- W: }$ R% w; D# v0 {- f# x# G为了对比,先将testfile文件输出如下:+ S3 {. k4 B5 G7 c5 m
- X3 A3 D/ p0 t; a: @. p' c6 |, C! Y
$ cat testfile #查看testfile 中的内容  & ]8 V; w: F! \2 Y5 w# W
Linux networks are becoming more and more common, but 6 x3 m/ S) K) p; M8 l
security is often an overlooked  
6 \1 R) X# Z/ J$ fissue. Unfortunately, in today’s environment all networks 6 s+ u' O% Y6 x
are potential hacker targets,  
$ L7 Z; \% D- C' e$ q* Wfrom top-secret military research networks to small home LANs.  
0 X& C7 }0 d, XLinux Network Security focuses on securing Linux in a
1 h( o$ {7 `1 X1 Y' d1 @; fnetworked environment, where the  : t2 A  p4 Y) t
security of the entire network needs to be considered
% l! q" l+ _/ P0 @$ Trather than just isolated machines.  
: m; \3 {- r# `! [# I: U1 NIt uses a mix of theory and practical techniques to
1 F9 m. J% Y8 u0 I8 |' Hteach administrators how to install and  0 z( u( M! j6 o6 Q. E  y4 B( m
use security applications, as well as how the " [/ ~$ m; z( K2 J' ]  p# J* x: I" I' f
applications work and why they are necessary. & G$ b5 c9 |2 p6 B% \

0 d  \$ \. [4 I2 U" U# V1 h/ |' L" v8 q1 R
然后使用fold命令折叠显示:
* B& {) G' F: l8 r6 v3 ~
  f. U* K" Y5 y5 L3 n( {6 p$ fold -w 30 testfile #行折叠成宽度为30,显示testfile 文件  % s, y  [) ]: {1 }$ b
Linux networks are becoming mo  
! U2 j2 D  a7 y) i" R/ d+ t- pre and more common, but securi  
8 @  x9 K, o' cty is often an overlooked issu  2 V* P9 p, I7 v# X
e. Unfortunately, in today’s  2 I4 o4 t% y6 c. ~. _( R! v$ G
environment all networks are  + `, H! r8 Q* E" Y" h; X
potential hacker targets, from  $ i7 E5 I; L( |4 w, N
top-secret military research  
2 O$ @$ G0 m+ ?. }  Y+ N& Nnetworks to small home LANs.  % Y, g7 R6 I  t6 @3 Z& Y- n
Linux Network Security focuses  
# q4 P' Z4 z& c3 t: b5 Eon securing Linux in a networ  6 [, p. i' g$ V* V2 t% H/ R
ked environment, where the sec  
* c* X" I4 l( K7 O2 ]2 I2 Hurity of the entire network ne  
# |$ J2 h/ B+ y9 |' h3 S8 w% Oeds to be considered rather th  % Z: j0 f' j6 F7 k( ]6 g
an just isolated machines. It  
' k( q) @0 Q2 Q8 Z  T5 r& L$ Iuses a mix of theory and pract  
9 n5 |2 `' [$ w0 M, s, X" i% ]ical techniques to teach admin  
5 f9 Q# b3 _% F: y$ X- Wistrators how to install and u  
5 t5 F7 i1 C2 m1 S' u$ cse security applications, as w  9 o2 ?- y5 q! _2 ]- r' |$ b( V1 B
ell as how the applications wo  + T) w7 Y/ Y3 D9 R8 K1 W4 E  ?
rk and why they are necessary
, w4 k# I4 Q+ [1 G9 D

该用户从未签到

4#
发表于 2021-9-23 13:26 | 只看该作者
fold指令会从指定的文件里读取内容,将超过限定列宽的列加入增列字符后,输出到标准输出设备
  • TA的每日心情

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

    [LV.1]初来乍到

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

    该用户从未签到

    2#
    发表于 2021-9-23 13:25 | 只看该作者
    Linux fold命令
    您需要登录后才可以回帖 登录 | 注册

    本版积分规则

    关闭

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

    EDA365公众号

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

    GMT+8, 2025-11-24 02:42 , Processed in 0.140625 second(s), 24 queries , Gzip On.

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

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

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