delete spevfic line from file [java] : i have a file that contains some data I want to delete some line from this file that contains specific substrings 

example for my file :

    {1:F21FIEGEGCXAXXX4781478239}{4:{177:1603150825}{451:0}}
    {1:F01FIEGEGCXAXXX4781478239}
    {2:O1030924160315RJHISARIAXXX83068856911603150825N}
    {4::20:PO/180797059/767
    :23B:CRED
    :32A:160315USD1405,19
    :50K:/213000010006082015619
    M A A H
    TABOUK 71411 PO BOX 000001
    :53B:/152700
    :57A:FIEGEGCXMIN
    :59:/3829
    ESAM ABDELALIM ABDELRAHMAN HABIB
    EGYPT
    :70:Family Expenses
    :71A:SHA-}
    {5:{MAC:00000000}{CHK:C04D5471B9E9}}{S:{SAC:}{COP:P}}

I want to delete every line ends with `{451:0}}` like the first line and `{COP:P}}` like the last line ? 
any help ?
