Contains 3 types of data streams:
• Standard input (stdin): code 0, Symbol < or <<; standard output (STDOUT): Code 1, Symbol > or >>; standard error Output (STDERR): Code 2, Symbol 2> or 2>>. •>Default iscoverFile contents, if you want toAppendThen use>>
Entering or outputting data from a specified stream is referred to as data redirection.
Pipeline
• The defining symbol for the piping command is "|" • Pipeline commands will only handle stdout, and stderr will be ignored • Pipeline commands must be able to receive data from the previous command as stdin using the pipeline command the primary purpose of the cut grep sort, WC, uniq Cut command is to decompose the data on the same row with the cut parameter:- D followed by a split character, used with-F, and-F splits a piece of information by the D-based split character, and uses-F to select the paragraph.
echo $PATH | Cut-d:-F 5
The grep command is a conditional fetch of a row whose basic syntax is:
[[Email protected]~]# grep [-ACINV] [--color=auto] ' Find string ' filename-a find the binary file as a text file-C calculates the number of occurrences of the ' found string '-I Ignore case-N and output line number-V Invert selection
In the last output information, it is removed as long as root, and only the first line is taken.
[[Email protected]~]# Last | grep ' Root ' | Cut-d '-F 1
Sort command ": Sort Uniq WC
The sort command is used to sort the input content
[[Email protected]~] # sort [-fbmnrtuk] [file or sdtin]-f ignore case difference----- ignore the first whitespace portion-----the name of the month to sort-R reverse sort-t The delimiter-K is sorted by the first number of intervals using the last to fetch the output data only from the Account column and sort last | cut-d '-F 1 | sort
Uniq command to remove duplicate rows from the result
Uniq [-ic]-i ignores case of different-C to count using last to list accounts, only to take out the account column, to sort out only once | Cut-d '-f1 | Sort |uniq-c
The WC command is used to count words, characters, lines,
-L Line-W character-M characters
Linux06--shell programming 02 Data Flow redirection and piping