AWK resolution, awk resolution
Cut command limitations
Df-h | cut-d ""-f 5/etc/passwd
The cut command cannot correctly intercept the content with spaces as the separator.
AWK format
Awk 'condition 1 {Action 1} condition 2 {Action 2 }... 'Filename'
Condition (Pattern) [relational expressions are generally used as conditions]:
X> 10 determine whether variable x is greater than 10
X> = 10 is greater than or equal
X <= 10 is less than or equal
Action ):
Formatted output: printf, print [\ n will be automatically added]
Process control statement: if/
Percentage of truncated/partitioned data
Df-h | grep sda2 | awk '{print $5}' | cut-d %-f1
BEGIN
Awk 'in in {printf "This is a test Script \ n"} {print $2 "\ t" $5} 'student.txt # first run the command followed by BEGIN
Awk 'in in {FS = ":"} {print $1 "\ t" $3} '/etc/passwd # display the specified separator
Awk-F: '{print $1 "\ t" $3}'/etc/passwd # Same as before
END
Cat/etc/passwd | grep/bin/bash | awk-F: 'End {print "The END... "} {print $1" \ t "$3} '# print the END Content Before the command ends.
Relational operators
Cat student.txt | grep-v NAME | awk '$3> = 80 {print $2 }'
Awk '$3> = 80 {print $2}' student.txt | grep-v NAME # An error may occur.
How to Use awk to analyze trace files
Not for the awk file, but for your. tr file, you need to write the awk code first, gawk-f loss. question added: it is the analysis of CBR data of WPAN. the TRACE file format is as follows: s 11.002432000
How to Use AWK to analyze tr files
The problem is too general. Please provide the tr file format and what do you want to analyze?