serial hex data sending?

i receive 10 bytes from the serial1 port and i need to send only some parts of it, to an ethernet server. for example ; if the code that i receive from the serial1 is: {0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,0x09,0x0a} i need to discard 0x02,0x03,0x04 and 0x05 and only send {0x01,0x06,0x07,0x08,0x09,0x0a};

what should i do?

Program it!

Do you get this as a string or in binary format? So do you get "{", then "0", then "x", then "0", then "1", then ",", etc. Or do you get the value 0x01, then 0x02, etc.?

i get it as binary data

In this case read it into a byte array and write it out by the needed ranges:

byte buffer[11];
for (byte i = 0; i < 10; i++) {
  while (!Serial1.available()); // wait for a character, you have to check for timeouts here
  buffer[i] = Serial1.read();
}
Serial.write(buffer, 1);
Serial.write(buffer+5, 5);

You certainly need to insert the error handling but this code should do what you described.