Interpret the Pig series Given an input of a Pig,
SickPig,
DeadPig,
QuinePig, or
DeafPig program, choose one of those
"languages" randomly and interpret the input as that "language."

First, randomly choose between one of the five members of the "Pig series":


Pig

If the choice was Pig, mimic the reference
interpreter by doing the following:


Find the first occurrence of the word PIG in the input
(case-sensitive).
If the word PIG does not appear in the input, output the message
File must contain the string 'PIG'. and exit.
Otherwise, split the input string on the first occurrence of PIG.
Output the text after the first occurrence of PIG to a file with a
filename of the text before PIG.

PIG may be contained in the text to be output (so, an input of
fooPIGbarPIGbaz should output barPIGbaz to a file called foo).


Note that the reference interpreter takes input via a command line argument
that specifies a filename to read from. However, your submission may take input in
any of the standard methods accepted on PPCG.
SickPig

If the choice was SickPig, follow the same instructions as Pig. However,
instead of writing the text after PIG to the file, choose randomly from
the following list

GRUNT
MOAN
OINK
BURP
GROAN
WHINE


and output that to the file instead. This random choice must be
independent of the previous choice (so, an output of GRUNT should
have a 1/5 * 1/6 = 1/30 chance overall).
DeadPig

DeadPig is like SickPig, but it always outputs the following string instead
of randomly choosing a string:

Your pig has unfortunately died. Please try again.

QuinePig

QuinePig is like Pig, but instead of writing the text after PIG to the
file, it instead writes the entire input to the file (so, an input of
fooPIGbarPIGbaz should output fooPIGbarPIGbaz to a file called foo).
DeafPig

If the choice was DeafPig, do nothing. (The pig is deaf... what do you
expect?)


Miscellaneous rules:


"Random" means each choice should be roughly equally likely (so, choosing Pig 90% of the time and the other variants only 2.5% of the time is invalid).
You may assume that the requested filenames will always be valid for your
file system (but they may contain spaces, etc.).
For all the variants of Pig, your code may optionally output a single
trailing newline to the file as well.
Since this is code-golf, the shortest code in bytes will win.
Bash, 251 246 bytes

r=$RANDOM
((r%5&lt;4))||exit
[[ $1 =~ PIG ]]||(echo "File must contain the string 'PIG'.";exit)
s=(GRUNT MOAN OINK BURP GROAN WHINE)
m=("${1#*PIG}" ${s[r%6]}
"Your pig has unfortunately died. Please try again." "$1")
echo -n "${m[r%5]}"&gt;"${1%%PIG*}"


This would be a lot shorter if deaf pigs could at least read...