JAVA-Read a file in java and write them into n different files based on unique words -


input program start , end position of unique word in each line db , text file.

for example: below input file start position 0 , end position 6 abcdef,store value , compare first 6 characters in second line ifs same copy them same file else copy them file.for every file there can 'n' no unique words ,n different files need created dynamically.positions change file file.the file size can more 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

you can string.split(string regex) , after split lines arraylists, can control want.

string split

java - arraylist

just read , learn them; send works, after that, can better. otherwise, means homework or , didn't learn java.


Comments