Advanced Bash− Scripting Guide An in− depth exploration of the art of shell scripting Me

源代码在线查看: form.awk

软件大小: 63 K
上传用户: xiaoy2000
关键词: 8722 exploration Scripting scripting
下载地址: 免注册下载 普通下载 VIP

相关代码

				# 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=1				while(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 Sun Mar 2 14:35:50   PST 1999				thisday=today[2]". "today[3]", "today[6]				}								{   for( i = 1; i < n; i++ ){					temp=form[i]					for ( j = 1; j 					    gsub("@date", thisday, temp)					    gsub("#" j, $j , temp )					}					print temp				    }				}							

相关资源