Program to sort data of file in java?

munishguptamg

munishguptamg

@munishguptamg-Znb4Gt Oct 20, 2024

i have three files among which i have stored the following information:
---------------------------------------------------------------
File1.txt contains following:

101 Harry Amritsar Punjab

---------------------------------------------------------------
Flie2.txt contains following:

102 Max Chandigarh Punjab
101 Mac Panchkula Haryana
---------------------------------------------------------------
I want to pick data from both files and save them into a third file File.txt in soorted order.
the sorting can be by Id or by Name

Replies

Welcome, guest

Join CrazyEngineers to reply, ask questions, and participate in conversations.

CrazyEngineers powered by Jatra Community Platform

  • Anoop Kumar

    Anoop Kumar

    @anoop-kumar-GDGRCn Mar 8, 2014

    You need to create map first with ID or Name with line number and then sort this map.
    After that again read the file extract the data from that line number put in a different file.

    How to read a specific line in file. see this
    #-Link-Snipped-#