попробуй это:
#!/usr/bin/awk -f
BEGIN {
#FPAT = "([^,]+)|(\"[^\"]+\")" # seperator is,
#FPAT = "([^,]*)|(\"[^\"]*\")" # seperator is, and allow empty field -> notice the "+" changed to "*"
FPAT = "([^ ]+)|(\"[^\"]*\")" # seperator is -> notice the "," changed to " "
}
{
printf("%d: ", FNR);
for (i = 1; i <= NF; i++) {
printf("%s ", $i)
}
printf("\n");
}
Я взял его из онлайн-руководства по GNU awk. Вот.https://www.gnu.org/software/gawk/manual/html_node/Splitting-By-Content.html
Даже если вы каким-то образом заработаете, вам действительно не следует использовать этот метод:
The file path can contain variables (0.7.6+), but such logs have some constraints:
- the user whose credentials are used by worker processes should have permissions to create files in a directory with such logs;
- buffered writes do not work;
- the file is opened and closed for each log write. However, since the descriptors of frequently used files can be stored in a cache, writing to the old file can continue during the time specified by the open_log_file_cache directive’s valid parameter
- [..]
Кроме того, error_log
вообще не принимает переменные.
Лучше использовать язык шаблонов/макросов для создания конфигураций. (Я предпочитаю для этого m4, см.man m4
).