Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9176439
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T17:06:34+00:00 2026-06-17T17:06:34+00:00

I am splitting a file into lines using a tokenizer: .split().tokenize(\n, 1) However, some

  • 0

I am splitting a file into lines using a tokenizer:

.split().tokenize("\n", 1)

However, some of the files I need to process will contain a header line, which will need to be processed differently to the normal lines. Is there an easy way to read the first line, process that, then split the remaining lines?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T17:06:34+00:00Added an answer on June 17, 2026 at 5:06 pm

    You can do something like this. It will use a content based router EIP, then different sub routes for processing.

    from(A)
       .split().tokenize("\n",1)
           .choice()
             .when(simple("${property.CamelSplitIndex} > 0"))
               .to("direct:processLine")
             .otherwise()
               .to("direct:processHeader");
    
    from("direct:processLine")
     .bean(processLineBean)
     .to(B);
    
    from("direct:processHeader")
     .bean(processHeaderBean)
     .to(B);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm currently splitting one xml file down into a number of smaller ones using
I'm looping over all lines in a file, splitting each line into tokens based
I would like to count the number of lines in a file, splitting it
After reading in a line from a file and splitting that line into tokens,
I'm trying to parse some huge JSON file (like http://eu.battle.net/auction-data/258993a3c6b974ef3e6f22ea6f822720/auctions.json ) using gson library
I am splitting up a comma delimited CSV-file by using this code below. It
I am working on splitting code into smaller files and refactoring it a bit.
I am extracting line by line from a file and splitting into words. I
I am reading from a comma seperated file and splitting the contents into an
I have some data files to import into a database with some unique delimiters:

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.