The built-in variable [plain] www.2cto.com awk in the awk language under AIX awk has many built-in variables used to set and modify environment information. The following table lists some commonly used built-in variables and their meanings: -------------------------------------------- ARGC command line parameter count ARGV command line parameter arrangement ENVIRON supports the number of records in the FNR Browser file using FILENAME awk browsing of system environment variables in the queue FS sets the input domain separator, equivalent to the command line-F option, the number of NF browsing records, the number of NR read records, the number of OFS output domain separator, the ORS output record separator, the RS control record delimiter ------------------------ the number of records: awk 'end {print NR} 'grade.txt 5 print the number of fields, row number, record, and file name awk' {Print NF, NR, $0} END {print FILENAME} 'grade.txt 7 1 M. tansley 05/99 48311 Green 8 40 44 7 2 J. lulu 06/99 48317 green 9 24 26 7 3 P. bunny 02/99 48 Yello 12 35 28 7 4 J. troll 07/99 4842 Brown-3 12 26 26 7 5 L. tansley 05/99 4712 Brown-2 12 30 28 grade.txt if there is data, find the data row containing Brown: awk '{if (NR> 0 & $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 NF powerful features echo $ PWD/usr/xxxx/ytcclb to retrieve the current directory name: echo $ PWD | awk-F/'{print $ NF} 'ytcclb get the file name and suffix echo "/usr/xxxx/ytcclb/cat_file.txt" | awk-F/' {print $ NF} 'cat_file.txt -- the end --