• Introduction to command line programming tool awk under Linux


    What is awk Awk is a compact programming language and command line tool. (its name comes from the initials of the surnames of its founders Alfred aho, Peter Weinberger and Brian Kernighan). It is very suitable for log processing on the server, mainly because awk can operate on files and usually construct lines in readable […]

  • How to view the number of online users of Apache


    # netstat -n | awk ‘/^tcp/ {++S[$NF]} END {for(a in S) print a, S[a]}’

  • Regular expressions in shell and common problems of SED and awk


    catalogue 1 +,?, and in regular expressions* What do they mean? 2 how to write regular expressions to match 11 digit mobile phone numbers? 3. Briefly describe the function and representation of SED addressing character. 4 how to use sed to extract even lines in text? 5 how to use sed to delete the fourth […]

  • Awk 99 multiplication table shell implementation code


    Implementation code: awk ‘BEGIN{for(i=1;i<=9;i++) {for(j=1;j<=i;j++) {printf “%d%s%d%s%dt”,j,“*”,i,“=”,i*j;}printf “n”}}’ design sketch:

  • A shell command a day Linux text content operation series – awk command details


    brief introduction Awk is a powerful text analysis tool. Compared with grep search and sed editing, awk is particularly powerful in data analysis and report generation. In short, awk is to read the file line by line, take the space as the default separator, slice each line, and then analyze the cut part.There are three […]

  • In Linux shell script, an array is passed to awk for internal processing


    Some time ago, I discussed a problem with several colleagues: how to transfer an array to awk for processing in shell script? There was no way. When discussing awk in QQ group two days ago, I accidentally talked about this topic again. By chance, I found a way to share. Test environment: [root]# head -1 […]

  • Introduction of awk basic command for Linux text analysis (8)


    Awk is a pattern scanning and processing language, which is a very powerful tool for data analysis and processing. awk [options] ‘pattern {action}’ file… The working process of awk is as follows: read the input (standard input or file) by line, and execute action for the line that conforms to the pattern. When pattern is […]

  • The usage of awk print in shell


    First, you need to understand how awk works1。 Awk reads the input file one line at a time.2。 For each row, it matches the pattern in the given order, and if it does, performs the corresponding action.3。 If there is no pattern matching, any action will be performed.4。 In the above syntax, either search mode […]

  • Explain awk command in Linux


    brief introduction Awk is a powerful tool for text analysis. Compared with grep search and sed editing, awk is particularly powerful in data analysis and report generation. In short, awk is to read the file line by line, slice each line with space as the default separator, and then conduct various analysis and processing on […]

  • Awk extracts a paragraph containing a keyword in Linux


    premise Awk is a language for processing text files and a powerful tool for text analysis. This article will use the command awk to extract the paragraph with a certain keyword. Prepare the data “Finalizer” #3 daemon prio=8 os_prio=0 tid=0x00007fb2dc1aa800 nid=0x63f6 in Object.wait() [0x00007fb2be61f000] java.lang.Thread.State: WAITING (on object monitor) at java.lang.Object.wait(Native Method) – waiting on […]

  • Using loops in awk


    Let’s learn about different types of loops that execute the same command multiple times. The awk script has three main parts: begin and end functions (both optional), and the user writes the function to execute each time. In a way, the main body of awk is a loop, because the commands in the function execute […]

  • Awk command line or script to help you sort text files (recommended)


    Awk is a powerful tool for performing certain tasks that may be done by other common utilities, including sort. Awk is a ubiquitous UNIX command that scans and processes text that contains predictable patterns. However, because of its function function, it can also be reasonably called programming language. Puzzling is that there is more than […]