You can use
ExecuteScript with Groovy and the following script (assuming your input is newline-delimited):
def flowFile = session.get()
if(!flowFile) return
def header = ''
session.read(flowFile, { inStream ->
header = new BufferedReader(new InputStreamReader(inStream)).readLine()
} as InputStreamCallback)
flowFile = session.putAttribute(flowFile, 'header', header)
session.transfer(flowFile, REL_SUCCESS)
This puts the first line in an attribute called 'header', which you can use with RouteOnAttribute to decide where to send the flow. Note that this script doesn't do error handling, but you could put a try/catch around the session.read to session.transfer, the catch could route the flow file to REL_FAILURE.