i have a text file which is about 1000 lines. as an example some of the first lines are given as bellow.
1 2 3 4 5 6
|
CallllStarted_Cap900 10.160.159.37 32514 unid to 10.9.11.66 32740 RABIA-TUJIMET-CERYAN at 2015 04 21 16 33 54 921.waa_end
CallStarted_Cap900 10.9.11.61 32572 3051905 to 10.9.11.18 39994 79970056 at 2015 04 21 16 33 54 994.waa_end
CallStarted_Cap900 10.160.167.34 32514 unid to 10.9.11.61 32580 RGorusme at 2015 04 21 16 33 55 035.waa_end
CallStartedAck_Cap900 10.160.159.37 32514 unid to 10.9.11.66 32740 RABIA-TUJIMET-CERYAN at 2015 04 21 16 33 54 921.waa_end
CallStartedAck_Cap900 10.9.11.61 32572 3051905 to 10.9.11.18 39994 79970056 at 2015 04 21 16 33 54 994.waa_end
CallStartedAck_Cap900 10.160.167.34 32514 unid to 10.9.11.61 32580 RGorusme at 2015 04 21 16 33 55 035.waa_end.
|
What i want to do: i would like to read the first line,after reading the line i would like to take under consideration all the characters after Cap900 then match these characters with the following whole text if match is found write that line under the line that its characters has been matched. After all lines matched i want to write these lines to other files which looks like this.
CallStarted_Cap900 10.160.159.37 32514 unid to 10.9.11.66 32740 RABIA-TUJIMET-CERYAN at 2015 04 21 16 33 54 921.waa_end
CallStartedAck_Cap900 10.160.159.37 32514 unid to 10.9.11.66 32740 RABIA-TUJIMET-CERYAN at 2015 04 21 16 33 54 921.waa_end
CallStarted_Cap900 10.9.11.61 32572 3051905 to 10.9.11.18 39994 79970056 at 2015 04 21 16 33 54 994.waa_end
CallStartedAck_Cap900 10.9.11.61 32572 3051905 to 10.9.11.18 39994 79970056 at 2015 04 21 16 33 54 994.waa_end
CallStarted_Cap900 10.160.167.34 32514 unid to 10.9.11.61 32580 RGorusme at 2015 04 21 16 33 55 035.waa_end
CallStartedAck_Cap900 10.160.167.34 32514 unid to 10.9.11.61 32580 RGorusme at 2015 04 21 16 33 55 035.waa_end. |
So far i have done how to read the file and read all line like this.
ifstream inFile;
inFile.open(inFileName);//open the input file
stringstream strStream;
strStream << inFile.rdbuf();//read the file
string original;
getline(inFile, original, '\0');
cout << original << endl; // print all the line from file
cout << "\nEnd of file reached\n" << endl;
But i am stuck on what to do now, any help would be appreciated.