====================================
Grep [Option] basic regular expression [file]
1. Option
-C: only counts matching rows.
-I is case insensitive (single character)
-H does not display file names (when multiple files are used)
-L only output file names (when multiple files are used)
-N: display matching rows and row numbers
-S does not display error messages
-V: Display All rows that do not contain matched text
2. query multiple files
Grep "sort" *. Doc
Grep "sort "*
3. Use a regular expression. It is best to enclose it in single quotation marks ('').
Grep '[ss] ORT' *. Doc
4. You can use the pipeline command. | the output on the left is the input on the right.
Grep '[ss] EPT 'data. f | grep 483
Awk
====================================
There are three methods to call awk
1. Command Line
Awk [-F field-separator] 'commands' input-file (s)
// [-F domain separator] is optional, because awk uses space as the default domain separator. If there is space in the field, you do not need to specify this option. However, for example, in the passwd file, the field separator is:-F must be specified for all fields. For example:
// Awk-F: 'commands' input-File
2. Write to the shell file
3. Write a separate file and call:
Awk-F awk-script-file input-files (s)
//-F indicates the awk script in the awk-script-file.
4. actions must be included in {}
--------------------------------
1. $1 $2... $ n indicates each domain, and $0 indicates all domains
2. Regular Expressions are included with //:/Regular Expressions/
3 .~ Match !~ Mismatch
4. If () is followed by (), you can use <= >>=! = & |
//
// Awk '{if ($4 = "yellow" & $2 ~ /[Gg] reen/)} 'filename'
//
---------------------------------