I am creating an output file inside an awk script which I want to compress then.
Input file - Marks.txt
Student1:AP:Maths:30:Science:43
Student2:AP:Maths:23:Science:35
Student3:Non_AP:Maths:17:Science:33
My code looks as below
BEGIN{
FS = ":"
}
$2 == "AP"{
print $3, $4 > "maths_AP.txt"
}
$2 == "Non_AP"{
print $3, $4 > "maths_non_AP.txt"
}
{...} #some other processing not relevant to question
I want to create both maths_AP.txt and maths_non_AP.txt as zipped files. Some forums suggest using gunzip function but I can't understand how to place it in the script.
awkcommand?