setpagedevice (postscript)

Basically, I'd like to apply a printer tray selection on postscript files by means of a (Bash) shell script.

What works on a Xerox DocuColor 5000, is this (exemplified for one tray):

sed "s/BeginPageSetup/&\n<<\/MediaColor (red)>> setpagedevice/" -i page.ps

Every attempt to do so on a Xerox DocuPrint 180, though, fails miserably :frowning:

What worked on the latter printer but refuses to do so for my postscript files:

sed "s/BeginPageSetup/&\n<<\/MediaType (red) \/MediaColor (red)>> setpagedevice/" -i page.ps

Any one any idea :confused: I'm as stuck as can be ...