⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 form.awk

📁 UNIX[1].shell范例精解(第4版)_code
💻 AWK
字号:
# form.awk is an awk script that requires access to 2 files: The# first file is called "form.letter." This file contains the# format for a form letter. The awk script uses another file,# "data.form," as its input file. This file contains the# information that will be substituted into the form letters in# the place of the numbers preceded by pound signs. Today's date# is substituted in the place of "@date" in "form.letter."BEGIN{ FS=":"; n=1while(getline < "form.letter" >  0) 	form[n++] = $0   # Store lines from form.letter in an array"date" | getline d; split(d, today, " ")	# Output of date is Fri Mar 2 14:35:50   PST 2004thisday=today[2]". "today[3]", "today[6]}{ for( i = 1; i < n; i++ ){	temp=form[i]	for ( j = 1; j <=NF; j++ ){	gsub("@date", thisday, temp)		gsub("#" j, $j , temp )	}print temp}}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -