How do I print in a .log file using awk command inside a ksh file? The script goes this way:
如何在ksh文件中使用awk命令在.log文件中打印?脚本就是这样的:
##create file here
## Start process
awk 'BEGIN {
some code here
}
{
##Logic here
##Print to file
}
END {}
' $OUTPUTNEEDEDTOBEPRINTED
1 个解决方案
#1
2
You can redirect within the awk
code:
您可以在awk代码中重定向:
##create file here
## Start process
awk 'BEGIN {
some code here
}
{
print > "myfile"
}
END {}
' "$OUTPUTNEEDEDTOBEPRINTED"
Or just redirect the output of you awk
或者只是重定向你的输出awk
##create file here
## Start process
awk 'BEGIN {
some code here
}
{
##Logic here
##Print to file
}
END {}
' "$OUTPUTNEEDEDTOBEPRINTED" > "myfile"
#1
2
You can redirect within the awk
code:
您可以在awk代码中重定向:
##create file here
## Start process
awk 'BEGIN {
some code here
}
{
print > "myfile"
}
END {}
' "$OUTPUTNEEDEDTOBEPRINTED"
Or just redirect the output of you awk
或者只是重定向你的输出awk
##create file here
## Start process
awk 'BEGIN {
some code here
}
{
##Logic here
##Print to file
}
END {}
' "$OUTPUTNEEDEDTOBEPRINTED" > "myfile"