I have to remove certain lines from a file. I file may look like this:
E2EDL37005 123244544-data-data-data
E2EDL44 123123123-data-data-data
E2EDL37005 123244544-data-data-data
E2EDL44 ........
What I need to do is remove the second occurrence of E2EDL37005 if the characters beside it are the same as the first.
Also, this must be written in Linux C++ and I have no idea where to start. Can anyone point me in the right direction?
Removing lines from a file
Started by
Guest_NeedHelp_*
, Nov 01 2006 10:03 AM
1 reply to this topic
#1
Guest_NeedHelp_*
Posted 01 November 2006 - 10:03 AM
Guest_NeedHelp_*
|
|
|
#2
Posted 01 November 2006 - 10:10 AM
perhaps read the text in one line at a time, parse the line into header and data. Store them in a data structure (say a map of <string,set<string>>?) and check for duplication before writing. Obviously, for a large file this could get obnoxious.


Sign In
Create Account

Back to top









