Printing to a printer

hi all, I am trying to print to my printer, but I dont know what the character encoding should be like.
I have code that sends data to the printer, but the formating stinks. How can I print clear messages to the printer using the arduino?
are there libraries to help format the printer output?
this line:
#!/bin/bash \n for i in seq 0 255 \n do \n nslookup 130.111.192.$i | grep flex \n done
prints out like:
#!/bin/bash
for i in seq 0 255
do
nslookup 130.111.192.$i | grep flex
done

#include <Ethernet.h>
#include <SPI.h>

byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xCA, 0xFE };
byte ip[] = { 192, 168, 1, 17 };
char data[] = {"#!/bin/bash \n for i in `seq 0 255` \n do \n nslookup 130.111.192.$i | grep flex \n done"};
byte server[] = { 192, 168, 1, 24 };  // the printer
EthernetClient client;

void setup()
{
  Ethernet.begin(mac, ip);
  Serial.begin(9600);
  client.connect(server, 9100);
  delay(1000);

  Serial.println("connecting...");
  //we told it to connect, lets check it with the "connected" function

  if (client.connected()) {
    Serial.println("connected to printer");
    client.write(data);
   }
}

void loop()
{
// IDK I only want to print once.
}

Does anyone have more information about using the network functions for printing via the Arduino, and formatting printing?

I have all official hardware Arduino Uno, and Ethernet shield, and I run Linux if any of that matters.

Put...

\r

...in front of all...

\n