• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Read a file and write them into different files based on unique words in each line

 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Input to the program would be start and end position of the unique word in each line from db and a text file.

For example: for the below input file start position is 0 and end position is 6 which is ABCDEF,store this value and compare with the first 6 characters in second line ifs its same copy them into same file else copy them into another file.For every file there can be 'n' no unique words ,n different files need to be created dynamically.positions will change file to file.The file size can be more than 10gb

Original input file: originalfile.txt ABCDEF aksjlnf woeirf 234 1234

FJHIJK sdfdf 3412344 124

ABCDEF asdhgbfl 3 agagd

FJHIJK agagafg 1 agag

output should be:splitfile1.txt

ABCDEF aksjlnf woeirf 234 1234

ABCDEF asdhgbfl 3 agagd

splitfile2.txt FJHIJK sdfdf 3412344 124

FJHIJK sdfdf 3412344 124
 
Sheriff
Posts: 7125
184
Eclipse IDE Postgres Database VI Editor Chrome Java Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Welcome to the Ranch!

What have you done so far? Post your code and please UseCodeTags (← that's a link).
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic