Okay so I have about 1000 duplicated phrases in this file, so doing this manually is not an option. Note that these are PHRASES, not lines or words, and each "phrase" is about 10 lines long.
我试图删除重复短语,但唯一使“项目”(或短语)重复的是立场表。 例:
class Item0
{
position[]={4347.6001,0,3214.6399};
azimut=128.81599;
special="NONE";
id=1;
side="EMPTY";
vehicle="Land_fortified_nest_small";
lock="UNLOCKED";
skill=0.2;
init="this setPos [4347.6, 3214.64, 0]; this setDir 128.816;";
};
class Item1
{
position[]={4347.6001,0,3214.6399};
azimut=128.81599;
special="NONE";
id=2;
side="EMPTY";
vehicle="Land_fortified_nest_small";
lock="UNLOCKED";
skill=0.2;
init="this setPos [4347.6, 3214.64, 0]; this setDir 128.816;";
};
现在,前两个短语是重复的,但ID和ITEM#是不同的,因此,确定重复短语的唯一途径是通过位置[]={}参数。 当两个短语具有相同立场时,不论国际发展法还是国际投资法编号,这两句话都重复了。
因此,我的目标是使用某种类型的代码、文字、方案或定期表达,删除所有重复短语,但留下第一个重复的词语。 因此,如果存在三个重复,则留下一个短语,但删除两个。 我怎么做呢?
An example of the desired input/output:
Input:
class Item0
{
position[]={4347.6001,0,3214.6399};
azimut=128.81599;
special="NONE";
id=1;
side="EMPTY";
vehicle="Land_fortified_nest_small";
lock="UNLOCKED";
skill=0.2;
init="this setPos [4347.6, 3214.64, 0]; this setDir 128.816;";
};
class Item1
{
position[]={4682.6001,0,3847.6399};
azimut=128.81599;
special="NONE";
id=2;
side="EMPTY";
vehicle="Land_fortified_nest_small";
lock="UNLOCKED";
skill=0.2;
init="this setPos [4682.6, 3847.64, 0]; this setDir 128.816;";
};
class Item2
{
position[]={4347.6001,0,3214.6399};
azimut=128.81599;
special="NONE";
id=3;
side="EMPTY";
vehicle="Land_fortified_nest_small";
lock="UNLOCKED";
skill=0.2;
init="this setPos [4347.6, 3214.64, 0]; this setDir 128.816;";
};
Output:
class Item0
{
position[]={4347.6001,0,3214.6399};
azimut=128.81599;
special="NONE";
id=1;
side="EMPTY";
vehicle="Land_fortified_nest_small";
lock="UNLOCKED";
skill=0.2;
init="this setPos [4347.6, 3214.64, 0]; this setDir 128.816;";
};
class Item1
{
position[]={4682.6001,0,3847.6399};
azimut=128.81599;
special="NONE";
id=2;
side="EMPTY";
vehicle="Land_fortified_nest_small";
lock="UNLOCKED";
skill=0.2;
init="this setPos [4682.6, 3847.64, 0]; this setDir 128.816;";
};