Linux Three Musketeers grep / sed / awk

grep / sed / awk linux referred to "trio"

grep to find more suitable for simple text or match;

sed more suitable text editor to match;

awk more suitable format text, the text is more complex kinds of processing;

 

  • Grep

--color = auto or --color: representation of the matched text color display

-i: ignore case when searching

-n: display the line number where the results

-c: count the number of rows to match the note is matched to the total number of rows, not the number of matches to

-o: Show only qualified string, but does not show the whole line, each qualifying string display line alone

-v: output without line keywords (reverse lookup, reverse match)

-w: whole words, if the word is contained in the string, as matching is not

-Ax: When the output after the specified number of rows comprising row results, where x refers to lines after, A: after

-Bx: When the number of lines output contain the specified row before a result, the previous line refers here x, B: before

-Cx: prior to inclusion in the output of the row after the specified number of lines and the results, where x refers to the line before and after, C: context

-e: a number of options to achieve matching, logical or relationship

-q: silent mode does not output any information, we only care about when there is no match to, but do not care to match what we can use this command, then use the match to see whether, 0 indicates "echo $?" to match, to 1 indicates no match.

-P: expressed compatible perl regular engine.

-E: Use extended regular expressions rather than basic regular expressions when using the "-E" option is equivalent to using egrep.

Guess you like

Origin www.cnblogs.com/developer-qin/p/11334849.html