pr command
pr command helps in generating the input in a printable format, with a properly defined column structure.
Syntax of pr command:
pr [options][filename}
Sample code:
Let’s say we created a file abc.txt that lists numbers from 1-to 10.
cat > file.txt
Output:
Now, let us apply a filter on the above file using the pr command :
pr -3 file.txt
Output:
Explanation :
By using the pr command in the above file, we filtered the contents of file.txt into 3 columns.
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.