Computer Hope

Other Pages

Home
Site map
Computer help

Dictionary
News
Q&A
What's new

Tools

E-mail this page
Print Preview
Edit this page



 

Linux / Unix fold command

Quick links

About fold
Syntax
Examples
Related commands
Linux / Unix main page

About fold

Filter for folding lines. This breaks the lines to have a maximum of x width column position (or bytes).

Syntax

fold [ -bs ] [-w width | -width] [file]

-b Count width in bytes rather than column positions.
-s If a segment of a line contains a blank character within the first width column positions (or bytes), break the line after the last such blank character meeting the width constraints. If there is no blank character meeting the requirements, the -s option will have no effect for that output segment of the input line.
-w width | -width Specify the maximum line length, in column positions (or bytes if -b is specified). If width is not a positive decimal number, an error is returned. The default value is 80.
file A path name of a text file to be folded. If no file operands are specified, the standard input will be used.

Examples

fold -5 myfile.txt > newfile.txt

The above command would fold the lines of myfile.txt to 5 character width and re-route the results to the file newfile.txt

Related commands

cut
pr

 

Index

Category:
Linux / Unix

Companies:
Click here

Related Pages:

Resolved

Were you able to locate the answer to your questions?

Home - Computer help - Contact - Dictionary - Links
Link to Computer Hope - Bookmark Computer Hope