Просьба помочь с написанием bash скрипта для поиска и удалению фрагмента по совпадению. Ломал голову и sed и grep но многострочный текст не удаляется.
К примеру документ «А» содержит текст
-----start-----
MIIEQjCCAqqgAwIBAgIEXs+uFTANBgkqhkiG9w0BAQsFADAnMREwDwYDVQQDEwhW
UE4gQXNpYTESMBAGA1UEChMJSXdhbiBDb3JwMB4XDTIwMDUyODEyMjcwMloXDTMw
MDUyNjEyMjcwMlowJzEVMBMGA1UEAwwMdXNlcjAyQGRpbV9hMQ4wDAYDVQQLEwV1
c2VyczCCAaIwDQYJKoZIhvcNAQEBBQADggGPADCCAYoCggGBANGitEuoK8LDefbS
QKN9sGE+TMqXumH639sGbSfCG7KcwiGkAHSz9wgNbSl67ZxN1SuaR44SCxxozKOn
SLTpn3drQMXEErfzj0/giGvfp0kD4SHL3Y7tcyrNPkRa8MN7RgSExis74+gozpQR
AgEAfVKNzCz+/OKUz6nZPtiY2MQMdq99jq1iPuhinJT9Y52Vf9EjOmt966b1s/dT
29pA5A4IgezhDUOuwCEAi9obH0tMt3MOLgsQ77ZLxP0T3KpRXKiGqWN6qobApwMz
E4Dh7H+rfPZenWZmZCH7Ufi/HNAasjce55moPRsc/+dx05rT21NkLDonXsVJGRWe
sMDGX705uFrooe/x6wHkmOZygo+sq53iEoxJaflBHRAGJNUzymh2uGgetQlmgIxe
1PrEIVpuEe4e69Z+DMAFOoZ00OWxYnMgMzsBL6YG1vcjaiOmBA7rIN3wWtokoK7a
2uiHM7eD7Nid4ddhamtAr5I5mwjiPfDQ9E5S0IsAUHbe/919RwIDAQABo3YwdDAM
BgNVHRMBAf8EAjAAMBMGA1UdJQQMMAoGCCsGAQUFBwMCMA8GA1UdDwEB/wQFAwMH
gAAwHQYDVR0OBBYEFIAD1Ttr54eBtzh07dskVF7UEtVFMB8GA1UdIwQYMBaAFCc/
hAJ5XgtZ1ROCo3H9f8BBm5+cMA0GCSqGSIb3DQEBCwUAA4IBgQCe1gLI1BD8GhHP
+IcP8EpBZKMaJeF8oD19CsVsDrHpzpzeSHi7T5Oox4cXR0j/CnSrKQxzWDWG1Jx+
UVzbMMI2z70dsu9WcK+zgSTJ2NBXKyZ/fQU92XYrJVGh0SZNAgxh21FFJTayuHls
jk/0Gde2I/SrSe8gRCA1QQNFiUgEvZNGv4mty66fvEvQxs5uJZHmWNPvc/GWScIe
xrISKDC5QmZPGmIzbsudeBThcTy420L75rTfZcXfZQDSBO7VFv23xmHhPNDWObBA
/06b5TYMxze96UUJc1E/l+D734n9UU+zoxNRh9PNEgsDzY3GMq6s5cxa54ZzIRn/
F7ZSP57uQOTjtTDm1NeIK56vKuxQqmi1cAUbLPe0AjmDNyd6G9jMZf+QCZY8SWaq
32BWPWvI9WZ1V8hGI7yho5+RCfwo5d/2FBN1j4LMfuKMOPWV1XwwMabNLOtaTCkP
D/BqEGdzCeMegSazqAw0n5ZDXLbkn9B3qrxrw5HL6SXzAuWadCc=
-----end-----
И есть файл «Б» с содержимым где без пробелов есть «много похожего теста». Как сделать так чтоб присвоить содержимое документа «А» переменной, и найти полное совпадение в документе «Б» и вырезать его удалить пробелы.
Документ «Б» :
-----start-----
MIIEQjCCAqqgAwIBAgIEXs+uDDANBgkqhkiG9w0BAQsFADAnMREwDwYDVQQDEwhW
UE4gQXNpYTESMBAGA1UEChMJSXdhbiBDb3JwMB4XDTIwMDUyODEyMjY1MloXDTMw
j0jhzmQVoNuXhDyn2vKAqA5U6WcnSbb7Nwlojt9fo0DApeelQBNHbBesUuhfDPMz
a9+lpspzzLtuVsStv+VHrbRcXp4Xl6TanHdxjTUV1UWjS9P+IdXFPmxdSfwEbb73
ylTq9UWKWa3rqSoF4UuQnlpEpqNNkfysV0LJ10vYVBOtG9OoPixqFwdqnAyNWn8y
unG40ObPJdSW99U8rINI3HTa9ksjeKkuc5BNh1vU9H6A8L5XzysVdn+ETrvi/Dye
b/wIBbPQY5r5EvxWPXJgPdVUoc7C+vJyfXBJglMd/iZ8ZjboUemUsjtyqu1sn+U5
TETo11fuiKcCMUwF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cvHA2rWv4/pjb/s6ZPLpQaxI
K01/+D5PbsoecYpXQnbA458lAFHN1lUQL+E4xPXPushDTqMq0DcVGzkFnyoNhgzf
NYdQHuIoUIuLpH1seWSgW0pDEHokTye37qMksNkWviBZ29p2v3xdVK5Oek/jkeX/
2rzoNOZKp7SlTWKDcA9ePuI5vDuDtxLkKuuev3MgNTNS75/2nwOtIDfaZwuf7uJm
1oZPk7GTosiWouIKviz0Ei3vFQGhthMa6aaCgPrP3EgmeDzaQBZbpbcrdUAOdt1b
oJXlhHZ8jXZCpP0UOlFo/tHAPRpf3gGZ4VaggS5BBvvdHbuvnTTlX7/Js74KlL9A
/NWT4gbgdkTPhUExWsfb6VrCjJ/X7Pg/H8kTwPt9XDMgOLud/QIDAQABo3YwdDAM
BgNVHRMBAf8EAjAAMBMGA1UdJQQMMAoGCCsGAQUFBwMCMA8GA1UdDwEB/wQFAwMH
gAAwHQYDVR0OBBYEFO1Pg7iB9oWH074Rhezvn0j12ktXMB8GA1UdIwQYMBaAFCc/
hAJ5XgtZ1ROCo3H9f8BBm5+cMA0GCSqGSIb3DQEBCwUAA4IBgQC4WlagnL0SWZhT
-----end-----
Новичек я, прошу сильно не пинать. Спасибо.
bash
merdan ( 17.06.20 15:53:16 MSK )