Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
for file in box*.dat; do
awk '{t+=$4;n++}END{print t/i}' $file > $file.txt
done
Because the code string with the $file variable was delimited with single quotes ( ' ). The $file is a shell variable and the shell does not expand the variable names in strings quoted with single quotes.ovince said:Steel I would like to know why the preliminary idea does not work
ovince said:how to introduce file names into awk to be able to work with within awk
awk '{print "the file is : [red]'[/red]$file[red]'[/red]"}' $file
[gray]# or[/gray]
awk [red]"[/red]{print [red]\[/red]"the file is : $file[red]\[/red]"}[red]"[/red] $file
[gray]# or[/gray]
awk [red]-vfile=$file[/red] '{print "the file is : "[red]file[/red]}' $file
[gray]# or[/gray]
awk '{print "the file is : "[red]FILENAME[/red]}' $file