I don't use filter commands at all, so I thought I'd at least summarize them and make them easier to remember, so I'll write them down. ..
A command that receives standard input, performs appropriate processing, and outputs it to standard output.
If you specify a file as an argument without options, it will display
number of lines`` number of words
number of bytes.
sort It sorts me. If there is no option, it will sort in alphabetical order according to the ASCII code. To be precise, it is just sorted in the order of the character code, so the order is as shown in the example below.
A Z a b
-n Sort in numerical order -r Sort in reverse order
uniq The basic operation is to display the lines excluding duplicate lines.
-c Count the number of times a line with the same content appears
cut You can cut out a part of the input
cut -d Delimiter-f field number file name
-d Specifying the delimiter(If not, they are separated by tabs) -Output only the specified byte on line b -Display only the specified character number on line c -f Specify the field number to be displayed -s Do not output lines that do not contain delimiters
The cut command must select and use only one of
It replaces the characters. Since a file cannot be specified as an argument, it can be used by handling it with an input redirect or by piped the output from an appropriate command.
(How to use)
tr option SET1 SET2
SET1 is the replacement string and
SET2 is the replacement string.
-d Delete the replacement target without replacing -s Replace the corresponding nth character of SET1 and SET2
(Regular expressions that can be used in SET)
\b backspace \n line break \t horizontal tab a-d Letters a to d in alphabetical order :cntrl:All control characters Read help for more information, it was in Japanese
tail Output the last n lines from standard input. If no option is specified, 10 lines will be output.
-Specify how many lines to output from the end to be displayed with n argument -f Monitor the file and display it when the content is added -v Shows the file name at the top
It outputs the difference between 2 files. In addition to the default format, there is also a
unified format as the output format. I have a habit of reading it, but I won't explain it here. Since git also uses unified format, it is better to output in unified format when using it. By the way, you can also compare directories.
-q Output only if the contents of the two files are different -s Output only if the contents of the two files are the same -u Output in unified format -a Treat all files as text -w Ignore all spaces -b Ignore all space differences -Z Ignore spaces at the end of lines