The built-in variable [plain] www.2cto in The AWK language in AIX. the comawk built-in variable awk has many built-in variables used to set environment information and can be modified. The following table lists some common built-in variables and their meanings: & mdash; & mdash; & md the built-in variable [plain] www.2cto.com AWK in The awk language under AIX has many built-in variables used to set environment information and can be modified. 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, it is equivalent to the command line-F option NF restart. View the number of fields of records NR number of records read OFS output field separator ORS output record separator RS control record separator ---------------------------------------- number of records: awk 'end {print NR} 'grade.txt 5 Number of printed 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 3 0 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 --
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.