zoukankan      html  css  js  c++  java
  • fold命令

    fold命令

    fold命令用于限制文件列宽,其会从指定的文件里读取内容,将超过限定列宽的列加入增列字符后,输出到标准输出设备。若不指定任何文件名称,或是所给予的文件名为-,则fold命令会从标准输入设备读取数据。

    语法

    fold [OPTION]... [FILE]...
    

    参数

    • -b, --bytes: 计算字节数而不是列数。
    • -s, --spaces: 在空格处跳过。
    • -w, --width=WIDTH: 使用n列,而不是默认值80
    • --help: 显示帮助信息。
    • --version: 显示版本信息。

    示例

    使用fold命令进行分隔,每行最多包含默认值80个字符。

    fold file.txt
    # fold command in Linux wraps each line in an input file to fit a specified width
    # and prints it to the standard output. By default, it wraps lines at a maximum wi
    # dth of 80 columns but this is configurable. To fold input using the fold command
    #  pass a file or standard input to the command.
    

    使用fold命令进行分隔,指定每行最多包含默认值50个字符。

    fold -w 50 file.txt
    # fold command in Linux wraps each line in an input
    # file to fit a specified width and prints it to the
    #  standard output. By default, it wraps lines at a
    # maximum width of 80 columns but this is configurab
    # le. To fold input using the fold command pass a fi
    # le or standard input to the command.
    

    使用fold命令进行分隔,并使用-s选项用于分隔空格上的行,以便不打断单词。

    fold -w 50 -s file.txt
    # fold command in Linux wraps each line in an input
    # file to fit a specified width and prints it to
    # the standard output. By default, it wraps lines
    # at a maximum width of 80 columns but this is
    # configurable. To fold input using the fold
    # command pass a file or standard input to the
    # command.
    

    每日一题

    https://github.com/WindrunnerMax/EveryDay
    

    参考

    https://www.computerhope.com/unix/ufold.htm
    https://www.runoob.com/linux/linux-comm-fold.html
    https://www.geeksforgeeks.org/fold-command-in-linux-with-examples/
    
  • 相关阅读:
    CentOS 7搭建SVN服务器
    CentOS 配置MySQL允许远程登录
    使用nginx实现基于tcp协议的https协议多域名指向的分别转发功能
    centos7 设置内核启动顺序
    nginx 针对特定地区的ip进行规则匹配
    【转】golang 交叉编译
    linux修改用户id,组id
    etcd 增减节点
    [转]etcd 启用 https
    windows 多网卡路由设置
  • 原文地址:https://www.cnblogs.com/WindrunnerMax/p/14123959.html
Copyright © 2011-2022 走看看