Linux cut command
The Linux cut command is a text processing command. This command is used to extract the specific column from a file. You need to define the column number and column delimiter with the command.
Syntax:
- -d This defines the deleter as a column separator. The default column separator is a single space or tab.
- -f Specify fields (column numbers) to fetch.
Example
Grep all usernames with their home directory created on a Linux system. The /etc/passwd file contained all users on a Linux system with other details. The first file of the file contains the username and the 6’th file contain the home directory of that user.
Fetch the column numbers 1,2,3,4 and 6. Here you can define a range using hyphens like 1-4.
You can also define multiple ranges with a single command.
0 Comments
CAN FEEDBACK
Emoji