1, to find a specific file -find
(1) find the file specified file name (pinpoint) under the current directory
(2) Global find the file specified filename (fuzzy search)
(3) to find files beginning with a prefix to distinguish case
(4) under the specified directory, find the beginning of a prefix file, case-insensitive
further instructions on the use of the find command:
man find
2, retrieve the file contents -grep and pipeline operator "|"
- grep full name: Global Regular Expression Print
- Role: Find files that match the criteria string
- The syntax is as follows:
grep [options] pattern file
Pipeline operators | role: an instruction may be connected, as an input the output of a preceding instruction is an instruction
using the pipeline note the following elements:
- Just before processing a command output correctly, does not handle error output
- You are able to receive the right of the standard command input stream, otherwise the data transfer process will be discarded
- sed, awk, grep, cut, head, top, less, more, wc, join, sort, split, etc., can be able to receive the standard input stream
Here is an example of a combination of:
3, the contents of the log statistics do -awk
points of awk:
- Reading a line of text, by slicing a delimiter input, into a plurality of part
- Sections were stored directly in the built-in variable, with $ 1, $ 1 ... ($ 0 represents the entire line)
- Support for a single slice is determined, determining the cycle support, default delimiter is a space
The syntax is as follows:
awk [options] 'cmd' file
Here is a practical example:
the original document reads as follows:
The following started screening:
4, the batch file to replace the contents of -sed
- Full name sed stream editor, stream editor
- On-line content suitable for processing text
syntax is as follows:
sed [option] 'sed command' filename