
Qwest
Novice
Sep 30, 2008, 11:01 AM
Post #1 of 14
(1059 views)
|
|
Comparing a two lines in one text file.
|
Can't Post
|
|
Hi, I am trying to compare two lines in a text file, and then print the difference. Basically, I have a text file as follows: Type1 "ObjName1" "Proj1" Type1 "ObjName1" "Proj2" Type2 "ObjName2" "Proj3" Type2 "ObjName3" "Proj4" Type3 "ObjName4" "Proj5" Type3 "ObjName4" "Proj6" ... I want to find the instances where "ObjectNameX" repeats, and print out "ProjX" Basically, I want to take the above, and Make it look like: Type1 "ObjName1" "Proj1" "Proj2" Type2 "ObjName2" "Proj3" Type2 "ObjName3" "Proj4" Type3 "ObjName4" "Proj5" "Proj6" ... The type is moot, (put needs to be printed) as the name has an Identifier that matches the type. The file is already sorted by Type, then ObjName, so duplicate names should be sequential. I would really appreciate some help on this, I have tried so many different things, and now I am completely baffled. Thanks!! [Edit] I also need to add another project to the end "#All" to every line.
(This post was edited by Qwest on Sep 30, 2008, 11:24 AM)
|