Reputation: 469
How do I print in a .log file using awk command inside a ksh file? The script goes this way:
##create file here
## Start process
awk 'BEGIN {
some code here
}
{
##Logic here
##Print to file
}
END {}
' $OUTPUTNEEDEDTOBEPRINTED
Upvotes: 0
Views: 245
Reputation: 41460
You can redirect within the awk
code:
##create file here
## Start process
awk 'BEGIN {
some code here
}
{
print > "myfile"
}
END {}
' "$OUTPUTNEEDEDTOBEPRINTED"
Or just redirect the output of you awk
##create file here
## Start process
awk 'BEGIN {
some code here
}
{
##Logic here
##Print to file
}
END {}
' "$OUTPUTNEEDEDTOBEPRINTED" > "myfile"
Upvotes: 2