awk output to a file
Posted
by Harish
on Stack Overflow
See other posts from Stack Overflow
or by Harish
Published on 2010-03-17T08:50:55Z
Indexed on
2010/03/17
9:01 UTC
Read the original article
Hit count: 317
I need help in moving the contents printed by awk to a text file. THis is a continuation of previous quesion I have to move all the contents into the same file so it is appending.
To be specific
nawk -v file="$FILE" 'BEGIN{RS=";"}
/select/{ gsub(/.*select/,"select");gsub(/\n+/,"");print file,$0;}
/update/{ gsub(/.*update/,"update");gsub(/\n+/,"");print file,$0;}
/insert/{ gsub(/.*insert/,"insert");gsub(/\n+/,"");print file,$0;}
' "$FILE"
How to get the print results to a text file appended one after the other in the same file?
© Stack Overflow or respective owner