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

Linux fold命令

[复制链接]

该用户从未签到

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

EDA365欢迎您登录!

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

x
$ u5 N2 l: ?9 W; B8 j( o  l# O; A3 O1 T# n
Linux fold命令用于限制文件列宽。# J6 l1 m/ {: \7 X

) U& i- c3 t0 l$ y3 J9 tfold指令会从指定的文件里读取内容,将超过限定列宽的列加入增列字符后,输出到标准输出设备。若不指定任何文件名称,或是所给予的文件名为"-",则fold指令会从标准输入设备读取数据。' @' h- W1 {0 r  H! Q8 L6 p
+ h/ l- o) a1 _

* n2 [9 I/ L5 r: p语法
! y3 P& q( w" p7 d( r5 a- C. S; a9 S1 O$ O1 f5 C
fold [-bs][-w<每列行数>][--help][--version][文件...]
# b5 K! i( m! e/ j2 Y$ w" i: ^5 ^5 X
5 L8 Z2 i. q. w

5 q0 m9 J6 B& c  S. q8 q, e( K参数:6 W% x5 _0 |- `( m! g' b

9 T: F. @7 r; G, ^) ?, L-b或--bytes 以Byte为单位计算列宽,而非采用行数编号为单位。" i+ X: ]0 c) p! S! M
-s或--spaces 以空格字符作为换列点。' K2 R6 V( ~2 J; ?( F
-w<每列行数>或--width<每列行数> 设置每列的最大行数。
! H3 d! ]5 u; _% T5 S, y--help 在线帮助。
& f, H  B; H( C  F& U--version 显示版本信息。! n# \3 m7 U: z1 |$ B: A) N

7 H8 g0 j5 J5 m/ v" \+ J: Q! V
* x; A: Q; |2 u( `% {
) ^% T: R: O+ I! o实例
; Y: G/ @5 X- \) I/ f! a. L1 r4 f0 H0 r" R( j
将一个名为testfile 的文件的行折叠成宽度为30,可使用如下命令:' _8 Z  T! {4 Y1 J

% Z+ v2 k2 O7 o0 K/ o0 Bfold -w 30 testfile, Q* W0 Y5 a$ Z8 ~

# O3 l, Y$ `. i
; H. l; ?9 P' N& T8 M7 E为了对比,先将testfile文件输出如下:0 N% H5 |1 ?8 u" z; P0 ^

& \& P* d7 P6 q0 k5 f1 m+ q$ cat testfile #查看testfile 中的内容  7 Q# Z4 L; \9 b$ s/ n) s& l
Linux networks are becoming more and more common, but
- O* C/ a# \% Ssecurity is often an overlooked  
3 I# _% d' I8 X; f  Gissue. Unfortunately, in today’s environment all networks
7 F5 Y* Q2 O0 T# E! ~are potential hacker targets,  # w6 b. i% o- g% i+ y6 Z& y
from top-secret military research networks to small home LANs.  2 v+ G& b# e/ A" F9 D
Linux Network Security focuses on securing Linux in a   x$ W) ^/ E7 O" x' r; x* f
networked environment, where the  
1 G( t% E, F& Y! Q3 o' ]8 @security of the entire network needs to be considered $ }+ E5 y! F% X& [
rather than just isolated machines.  
  _& Z1 B- Z( J$ V/ FIt uses a mix of theory and practical techniques to 0 |$ @4 P, V" Y4 L; r
teach administrators how to install and  ) W' c: d4 G4 B9 _
use security applications, as well as how the
8 h' G6 ?. N: B; [applications work and why they are necessary. % Z' ]  A, n1 Q+ L0 f. r
. X% t$ f) ~, C- B" _

1 ~' k3 y* s: L& V8 r6 U) _然后使用fold命令折叠显示:
2 Y8 Y9 Q( H! \  L
3 y* S2 `/ }9 o* \1 @! k$ fold -w 30 testfile #行折叠成宽度为30,显示testfile 文件  
% Z: P! A4 t0 K& N9 y7 L' a. h8 kLinux networks are becoming mo  
; q; q& v3 L: l. V3 w. t- e: x* N- e! _re and more common, but securi  , Y' p, V( Y- o. ]$ L
ty is often an overlooked issu  * }' B; u( \( O9 P  j2 U9 z
e. Unfortunately, in today’s  " H: p3 F8 s# ?& ]1 k
environment all networks are  5 t9 V' Q- f& x5 g
potential hacker targets, from  $ f( r0 M( U' E* N
top-secret military research  7 H+ m- c3 w8 p
networks to small home LANs.  
. P: a0 E2 `+ @7 F& I2 Y  k" C7 F& d2 {Linux Network Security focuses  % A* Q- F5 H9 h  g
on securing Linux in a networ  
" S& f9 e0 t, A" @" z2 Sked environment, where the sec  4 H5 D( E+ k9 D2 a7 t' B
urity of the entire network ne  
: u" g! ^. ?. U! {. Beds to be considered rather th  . h% t+ X+ U. u4 k, U
an just isolated machines. It  
0 T: u" w% f& n0 U! kuses a mix of theory and pract  
( C$ N' t! @. d4 l( ~ical techniques to teach admin  2 F- G* B( g) A
istrators how to install and u  
- K+ I1 U3 t: n2 S& f# rse security applications, as w  , v, _" P  h9 @) B
ell as how the applications wo  ) C: {- C9 \9 w
rk and why they are necessary
: a. G" _2 u5 a0 X  N: b

该用户从未签到

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-10-13 04:38 , Processed in 0.125000 second(s), 23 queries , Gzip On.

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

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

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