In the AWK language of AIX, the regular expression [plain] www.2cto.com can be used in the awk command to use the regular expression awk. The metacharacters are as follows: \, ^ ,., [], |, (), *, + ,? +: Match one or more characters?: The occurrence frequency of the matching mode./XY? Z/matching XYZ, YZ condition operator description ----------- --------------- <less than <= less than or equal to = equal! = Not equal to> = greater than or equal ~ Match regular expression !~ Does not match the regular expression 1. Matches the row in the fourth column of the grade.txt file that contains Brown: awk '{if ($4 ~ /Brown/) print $0} 'grade.txt J. troll 07/99 4842 Brown-3 12 26 26 L. tansley 05/99 4712 Brown-2 12 30 28 as long as it contains Brown, print the data: awk '$0 ~ /Brown/'grade.txt J. troll 07/99 4842 Brown-3 12 26 26 L. tansley 05/99 4712 Brown-2 12 30 28 2. exact match print the row in the third column containing 42: awk '{if ($3 ~ /42/) print $0} 'grade.txt J. troll 07/99 4842 Brown-3 12 26 26 print the third column containing 48 rows: awk '$3 ==48 {print $0}' grade.txt P. bunny 02/99 48 Yello 12 35 28 3. the third column does not contain 48 rows: awk '$3! ~ 48 {print $0} 'grade.txt L. tansley 05/99 4712 Brown-2 12 30 28 view all rows: pg grade.txt M. tansley 05/99 48311 Green 8 40 44 J. lulu 06/99 48317 green 9 24 26 P. bunny 02/99 48 Yello 12 35 28 J. troll 07/99 4842 Brown-3 12 26 26 L. tansley 05/99 4712 Brown-2 12 30 28 print rows that do not contain Brown: awk '$0! ~ /Brown/'grade.txt M. tansley 05/99 48311 Green 8 40 44 J. lulu 06/99 48317 green 9 24 26 P. bunny 02/99 48 Yello 12 35 28 print the fourth domain that does not contain "Brown-2" row: awk '$4! = "Brown-2" {print $0} 'grade.txt M. tansley 05/99 48311 Green 8 40 44 J. lulu 06/99 48317 green 9 24 26 P. bunny 02/99 48 Yello 12 35 28 J. troll 07/99 4842 Brown-3 12 26 26 4. larger than awk '{if ($6> $7) print $1}' grade.txt P. bunny L. tansley 5. less than awk '{if ($6 <$7) print $0}' grade.txt M. tansley 05/99 48311 Green 8 40 44 J. lulu 06/99 48317 green 9 24 26 6. case Sensitive awk '/[Gg] reen/'grade.txt M. tansley 05/99 4831 1 Green 8 40 44 J. Lulu 06/99 48317 green 9 24 26 7. Line awk '$1 ~ /^... A/'grade.txt M. tansley 05/99 48311 Green 8 40 44 L. tansley 05/99 4712 Brown-2 12 30 28 8. or the link matching row contains Yellow or Brown: awk '$0 ~ /(Yellow | Brown)/'grade.txt J. troll 07/99 4842 Brown-3 12 26 26 L. tansley 05/99 4712 Brown-2 12 30 28 rows contain G (g) reen: awk '$0 ~ /(G | g) reen/'grade.txt M. tansley 05/99 48311 Green 8 40 44 J. lulu 06/99 48317 green 9 24 26 9. first line: ^ 10. & and awk '{if ($1 = "P. bunny "& $4 =" Yello ") print $0} 'grade.txt P. bunny 02/99 48 Yello 12 35 28 11. | or awk '{if ($4 = "Yello" | $4 ~ /Brown/) print $0} 'grade.txt P. bunny 02/99 48 Yello 12 35 28 J. troll 07/99 4842 Brown-3 12 26 26 L. tansley 05/99 4712 Brown-2 12 30 28 12 .! Awk '$0 !~ /2/'grade.txt M. Tansley 05/99 48311 Green 8 40 44 -- the end --