What is an example of a proper use in Ubunto-Linux of these utilities: sort, uniq, cut, paste? Show syntax and output.
What is an example of a proper use in Ubunto-Linux of these utilities: sort, uniq, cut, paste? Show syntax and output.
Sort in Ubuntu-Linux
Sort command in Ubuntu-Linux is very helpful to sort the text file by arranging text lines in a particular order. The order can be set according to file size, file type, modified date, name either alphabetically or numerically.
Syntax:
$ sort [options] file_name.txt |
available options are
-n : To sort numerically
-r : To sort in reverse order
-R : To sort in random order
.-M : Sorting according to months
-k : Sort as per specified column
-u : Sort with deleting duplicate
-f : Ignore case while sorting
-h : Sort according to human numeric values
Example
To perform sorting, first, create a file named myFile.txt using cat command
Command : $ cat > myFile.txt java cobol python visual basic php html |
Now use the sort command to sort file alphabetically
Command : $ sort myFile.txt Output : cobol html java php python visual basic |
Step by step
Solved in 4 steps