Output filters: &&,cut , Sort Uniq and Grep
&&: And operators. IF this is true , it will run the next thing
If this is NOT true, don't run the next thing.. It works as IF in programming.
Operator (&&)
The AND Operator (&&) would execute the second command only, if the execution of first command SUCCEEDS, i.e., the exit status of the first command is 0. This command is very useful in checking the execution status of last command.
So we got this file called My wonderful file
WE will try to run it.
the last command had an error in the name of the file, so it 's not true and it won't run it.
Sort, a UNIX and Linux command for sorting lines of text files. You can be sorting in alphabetical order, reverse order sorting, sorting by number, and mixed case sorting.
Now check the other output in a filed called a anewoutput2.txt
Cut command is for cutting out the sections from each line of files and writing the result to standard output. It can be used to cut parts of a line by byte position, character, and field. Basically the cut command slices a line and extracts the text.
Uniq: The uniq command in Linux is a command-line utility that reports or filters out the repeated lines in a file. In simple words, uniq is the tool that helps to detect the adjacent duplicate lines and also deletes the duplicate lines.
We will make a duplicate using nano text editor
We save it with Crtl +O and CTRL + X to exit
WC Command Count Number of Lines, Words, Characters in Linux.
Grep command in Unix/Linux is a is an interesting find and filtering tool.. The grep filter searches a file for a particular pattern of characters and displays all lines that contain that pattern. The pattern that is searched in the file is referred to as the regular expression (grep stands for globally search for regular expression and print out)
Grep is awesome for filtering and finish some lines that you are looking for..
Miami and great are the first names in the previous files that we made
Now we want to filter where which file put the name Bono..We need to filter all the places..
So you learned how to use how &&, Sort ,Uniq,Cut, WC and Grep work.
If you like it and understood please click like!
Output filters: &&,cut , Sort Uniq and Grep
Reviewed by ohhhvictor
on
August 09, 2018
Rating:
No comments: