[英]Awk in loopwith different file
I have four files and want to run a awk code on each file. 我有四个文件,想在每个文件上运行awk代码。 But this code is not working.
但是此代码不起作用。
My code: 我的代码:
for i in "udp-250b.tr" "udp-50b.tr"
do
awk '
BEGIN {
//some code
}
{
//some code
}
END {
//some code
} ' i
done
Awk
can work with multiple files no need of for
Awk
可以使用多个文件没有必要的工作for
syntax will be like this 语法会像这样
awk '{ }' file1 file2 file3
or 要么
awk '{ }' file*
In your case 就你而言
awk 'BEGIN{ } { } END{ }' udp-*.tr
To correct your existing code change
更正现有代码更改
} ' i
To 至
} ' "$i"
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.