Tag Archives: linux command

linux grep command – grep not include, grep reverse match

There is also a case where we need to exclude certain content when we do content search. How to achieve it? Still linux grep command! I have such a file test5.txt. Need to query the line containing “dfff” content but … Continue reading

Posted in File & Directory | Tagged , , | Comments Off on linux grep command – grep not include, grep reverse match

linux grep command – grep only show match

When we search for content, sometimes we just need to show matching content. At this time we can use the grep command. linux grep You can also display the line number where the matching content is located. linux grep -n … Continue reading

Posted in File & Directory | Tagged , , , | Comments Off on linux grep command – grep only show match

AWK tutorial: three ways of awk execution

Linux awk command execution ways: 1. Command line execution Detailed introduction of syntax, see 《Linux awk》 2. Shell script file execution Explanation: !/usr/bin/awk The first line of #!/usr/bin/awk is the awk command location. use : ➜ which awk /usr/bin/awk 3. … Continue reading

Posted in Awk Command, Text Processing | Tagged , , , | Comments Off on AWK tutorial: three ways of awk execution

linux grep command – grep multiple patterns

The last article 《grep or condition, grep and condition》 introduced grep and, or use, including the use of the -e parameter. Here is a detailed description of the use of the -e parameter. grep one pattern ➜ grep “12” test1.txt … Continue reading

Posted in File & Directory | Tagged , , , | Comments Off on linux grep command – grep multiple patterns

grep show lines before and after

Usually when searching for keywords, we need to look at the keyword context information, all of which use -A, -B and -C parameters. Show num rows after matching – grep -A Show num rows before matching – grep -B Show … Continue reading

Posted in File & Directory | Tagged , , | Comments Off on grep show lines before and after

linux grep or , grep and , grep not condition examples

Linux grep conditional;

Grep OR:
1. Use regular, grep -E “[A|B]”;
2. Use -e,grep -e “A” -e “B”;

Grep AND:
Use pipe, grep “A” | grep “B”;

Grep NOT: use grep -v Continue reading

Posted in File & Directory | Tagged , , , | Comments Off on linux grep or , grep and , grep not condition examples

AWK tutorial: awk sort uniq

In daily development, we often use awk command to cut and sort log file columns and count them. awk sort uniq count example awk column count linux Sort – n : sorted by the size of the value; – r … Continue reading

Posted in Awk Command, Text Processing | Tagged , , , | Comments Off on AWK tutorial: awk sort uniq

linux grep regex examples

Grep regex matches the search content according to the specified rule pattern, which can help us find the content we need precisely. Syntax: grep -E “pattern” file Continue reading

Posted in File & Directory | Tagged , , | Comments Off on linux grep regex examples

AWK tutorial: split on character awk or cut

In the previous article, we introduced the use of linux awk for string cutting. Here we introduce a method. use awk -F parameter use awk split function For more awk usage, please refer to the following article: Let’s look at … Continue reading

Posted in Awk Command, Text Processing | Tagged , , , | Comments Off on AWK tutorial: split on character awk or cut

AWK tutorial: awk [-F] print example

– awk print last field
– print line number per line
– print specific columns
– use -F specifies a delimiter Continue reading

Posted in Awk Command, Text Processing | Tagged , , , , | Comments Off on AWK tutorial: awk [-F] print example

AWK tutorial: awk remove last character

awk remove last character use awk length and substr functions

Posted in Awk Command, Text Processing | Tagged , , , | Comments Off on AWK tutorial: awk remove last character

linux find command tutorial: find syntax and examples

linux find – search for files in a directory hierarchy. syntax examples use find command – find file find – type filter explanation where x may be any of: b – block device (buffered); c – character device (unbuffered); d … Continue reading

Posted in File & Directory | Tagged , , | Comments Off on linux find command tutorial: find syntax and examples

AWK tutorial: awk save to file

AWK save to file AWK append to file

Posted in Awk Command, Text Processing | Tagged , , , | 1 Comment

Awk tutorial: awk man

awk man

Posted in Awk Command, Text Processing | Tagged , | 2 Comments

AWK tutorial: awk newline character

How to use Awk print out a newline character in a string ???

Posted in Awk Command, Text Processing | Tagged , , | 2 Comments