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

Linux fold命令

[复制链接]

该用户从未签到

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

EDA365欢迎您登录!

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

x

; E8 I1 o! M+ F( n- r# GLinux fold命令用于限制文件列宽。
$ d- \0 R$ K, }: w' @  E) @) d& y, |& P3 K( o; q
fold指令会从指定的文件里读取内容,将超过限定列宽的列加入增列字符后,输出到标准输出设备。若不指定任何文件名称,或是所给予的文件名为"-",则fold指令会从标准输入设备读取数据。
! G/ X' E  w+ k* k; l* F5 s* f# |
7 Y- T% i# j* f: W6 {( \1 ^7 q0 t! n- O3 D3 I  q* k4 T6 f# j
语法
7 u, @4 k7 {/ a' U: k+ j' w# c
& Y6 N# N: \+ w- qfold [-bs][-w<每列行数>][--help][--version][文件...]
4 e' V  L. ~3 h
6 A0 J$ u2 K# l' Z  U0 N0 [( E2 Q2 B7 V, U7 r

, k. t% p$ d! h3 v参数:( O8 G3 |' w* t- U% `" L

: ]9 Q' G, n* g) @4 m* X, E  o8 |-b或--bytes 以Byte为单位计算列宽,而非采用行数编号为单位。; d; S9 _8 ~! m# f& n, Q
-s或--spaces 以空格字符作为换列点。4 }3 P* t- l% {! u5 P6 h1 E; }
-w<每列行数>或--width<每列行数> 设置每列的最大行数。% j- o" D( B- P% W- f+ ~+ q9 n1 R
--help 在线帮助。8 ^  E. H* s! B- [+ B
--version 显示版本信息。3 N/ b& b) R. w$ e; |0 ?
, z6 y# b& K" V" U9 N
' [9 _0 ^: o" K. u: H; R+ K
1 ]: v' ~0 E& v. a
实例
- k" o- y6 r- ]0 g7 S# v- g5 M7 N1 |
; a3 k) F3 R4 h4 E将一个名为testfile 的文件的行折叠成宽度为30,可使用如下命令:! \0 F( D+ g$ ^1 f7 z
, o* w* ^# H+ D1 N
fold -w 30 testfile
8 i/ I8 |' ?) ^$ y9 t. f7 d6 [
* _7 \3 p1 S, U2 A" \- @$ V) |4 M& |' B' X3 Q, [5 |2 m% A
为了对比,先将testfile文件输出如下:
+ b9 o0 A1 U& @
  N" m- t/ |0 d4 |9 I$ f$ cat testfile #查看testfile 中的内容  
* }- N: }% G2 u5 \  `/ H1 [9 ^Linux networks are becoming more and more common, but
' e. X) z4 d. [, e9 Z; k6 _  Lsecurity is often an overlooked  % ?" s; m6 E9 S' X, Z5 P
issue. Unfortunately, in today’s environment all networks
! O9 w+ b9 O. B& x- Bare potential hacker targets,  / }! Q8 S6 }" K) B, l8 n) N
from top-secret military research networks to small home LANs.  
: i3 s$ L  D9 o2 ]5 q, C1 rLinux Network Security focuses on securing Linux in a ; j( u3 {7 Y: m: m
networked environment, where the  / H5 L+ p3 e' N) ]
security of the entire network needs to be considered
5 x! X( U/ k1 C0 m* y9 krather than just isolated machines.  8 q0 r3 X) K/ g- K
It uses a mix of theory and practical techniques to
9 A- ]3 V! [7 ~5 q, A. k" bteach administrators how to install and  
" o# V9 g# d- I2 p* F/ e% [use security applications, as well as how the + q* C) e* ^# V) C
applications work and why they are necessary. / o3 Q- R1 X' X
. ^- q! n& j' d! w. v
* S4 O" q+ B& \; S% `1 c/ K; E
然后使用fold命令折叠显示:3 L6 A+ X; w. Q1 a( q* y9 m! S2 R2 h
1 }6 t7 G* J( I1 q- d. m
$ fold -w 30 testfile #行折叠成宽度为30,显示testfile 文件  
4 B) |- h# U) f" ?" Q, BLinux networks are becoming mo  
7 r/ E" f8 U& d3 Rre and more common, but securi  - W9 B, H9 S" a4 V
ty is often an overlooked issu  ; F1 m. z% m. P: r4 |
e. Unfortunately, in today’s  ' u- I: L  g$ n7 _5 r. n7 p2 v
environment all networks are  
! g  i) u/ l. p' Q0 C" Q/ ^potential hacker targets, from  
2 T6 J3 m' Z3 i2 P! q' Ktop-secret military research  
0 L% g/ Q' T" H$ v; T; e) }# Anetworks to small home LANs.  : A  D0 _, e7 g& k; ~
Linux Network Security focuses  
" f% N0 A4 D8 T# Y% Ion securing Linux in a networ  
5 S0 [* |- i2 c9 ~ked environment, where the sec  8 T: C; `6 d3 a: y! _
urity of the entire network ne  
& _, _/ e, M! C( r: Oeds to be considered rather th  8 K6 e( X, H% @) S' k% G
an just isolated machines. It  3 S0 N. g" B1 C0 n# H2 X
uses a mix of theory and pract  : x* O( j0 C1 S' ?$ i7 O# u* V& J
ical techniques to teach admin  
# M; T8 V& d' y  l& P  `; P- b6 o2 ^istrators how to install and u  + `" K9 c/ w& ^% `7 G5 g, M/ x
se security applications, as w  
0 |- |6 A- q' `- H0 t$ J( Q0 Hell as how the applications wo  ) [5 S' b+ |" T5 {
rk and why they are necessary
: `$ i+ i- `% @6 f

该用户从未签到

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-11-24 02:59 , Processed in 0.140625 second(s), 23 queries , Gzip On.

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

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

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