如何在ksh文件中使用awk命令在.log文件中打印? 脚本就是这样的:
##create file here
## Start process
awk 'BEGIN {
some code here
}
{
##Logic here
##Print to file
}
END {}
' $OUTPUTNEEDEDTOBEPRINTED
答案 0 :(得分:2)
您可以在awk
代码中重定向:
##create file here
## Start process
awk 'BEGIN {
some code here
}
{
print > "myfile"
}
END {}
' "$OUTPUTNEEDEDTOBEPRINTED"
或者只是重定向您的输出awk
##create file here
## Start process
awk 'BEGIN {
some code here
}
{
##Logic here
##Print to file
}
END {}
' "$OUTPUTNEEDEDTOBEPRINTED" > "myfile"