fmt command
fmt command is a Linux Filtering Command, which helps in reformatting input data and printing it with the result of standard output.
Syntax of fmt command
fmt [-WIDTH] [OPTION]… [FILE]…
Sample code:
Let us consider we had a text file that contains data of some names and we can reformat them using this fmt command.
cat data.txt
Now, let’s reformat the data in the above file using fmt:
fmt -w 1 data.txt
Output :
Explanation:
We have reformatted the contents of data.txt file by using the fmt command. Our contents of data.txt have been formatted and now the contents of data.txt are in a more readable format.
Useful Commands For Filtering Text for Effective File Operations in Linux
In this article, let us learn about different commands used in Linux for filtering text to implement effective file operations on Linux Machines.