I rewrite my previous question because it was unclear.
I have test1.txt formatted in this way (this example has 3 lines)
Link;alfa (zz);some text;
Link;alfa (zz);other text;other text2;
Link;jack;
In another filetext test2.txt I have text formatted in this way without delimiters ;
but only as simple string (this example has 2 lines)
tommy emmanuel
alfa (zz)
In test2.txt
I have never Link
word and I can I have (
)
characters but I have never ;
delimiter character
I want to get result.txt written in this way
Link;jack;
Logic behind : In test2.txt I have alfa (zz)
. This string / field is the same in test1.txt - I have the same string alfa (zz)
on first and second line between;
delimiter. Condition: if this field match happens then that lines should be deleted and for this reason I written that I expect only 3rd line
Link;jack;
I test this code
sed 's/.*Link;//;s/;.*//' test2.txt | grep -Fvf- test1.txt
and this
awk -F \; '
FNR == NR {cull[$0]=""}
FNR != NR {
for (str in cull) {
if ($2 == str) {
next
}
}
print
}' test2.txt test1.txt > culled.txt
Problem is that it rewrite me same lines and don't delete lines with same fields
Update question:
According to anubhava answer and this example the presence of this kind of strings don't remove lines
If I have inside test2.txt
Dark Tranquillity - A Moonclad Reflection [ep] (1992) Melodic Death Metal
Dark Tranquillity - A Closer End [best of_compilation] (2008) Melodic Death Metal
then I can't match and remove lines in text1.txt if I have these lines
Link;Dark Tranquillity - A Moonclad Reflection [ep] (1992) Melodic Death Metal;Dark Tranquillity - A moonclad reflection [7'' Ep 1992_Slaughter Rec.].rar;https://disk.yandex.com/public?hash=JA7Gu2CysxSf2HhAKaBxmU%2By27B6dPd6uRwPFu%2B9x0s%3D;https://metalarea.org/forum/index.php?showtopic=5037
Link;Dark Tranquillity - A Closer End [best of_compilation] (2008) Melodic Death Metal;Dark Tranquillity - A Closer End [2008].rar;https://disk.yandex.com/public?hash=RCZbOrqci8lX%2Fa%2BPzhB6vchlr5rXyc%2B2NHiJNCu%2BQYM%3D;https://metalarea.org/forum/index.php?showtopic=48557