如何使用awk命令在ksh文件中打印文件
问题描述:
如何使用awk命令在ksh文件中打印.log文件? 脚本去是这样的:如何使用awk命令在ksh文件中打印文件
##create file here
## Start process
awk 'BEGIN {
some code here
}
{
##Logic here
##Print to file
}
END {}
' $OUTPUTNEEDEDTOBEPRINTED
答
您可以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"
只是重新定位你的'print's :'print ...>“my.log”'。 – fedorqui 2015-02-10 11:29:12