Not an easy or affordable swap. You would need to cut the motor mount perches from the frame and weld new ones, not to mention the 6cyl wiring harness. Also need the transmission, transfer case, and driveshafts from a 6cyl jeep.
Much cheaper and easier to sell your Jeep and buy a 4.0L Jeep if that's what you want, avoiding a hacked up install of a motor swap.