can be done in one pass through файл1 :
$ sed -i -f <(...) файл1
where ... is a command that generates a list of regular expressions. regular expressions can use your same - /искомая строка/d , or you can slightly clarify - /^искомая строка:/d - add a binding to the beginning of the string and to the symbol :
Ie, instead of ... suggest using something like sed 's,^,/^,;s,$,:/d,' файл2
total:
$ sed -i -f <(sed 's,^,/^,;s,$,:/d,' файл2) файл1
if the files have the following lines:
$ cat файл1 почта1:имя1:фамилия1:возраст1 почта2:имя2:фамилия2:возраст2 почта3:имя3:фамилия3:возраст3 почта4:имя4:фамилия4:возраст4 почта5:имя5:фамилия5:возраст5 $ cat файл2 почта2 почта5
the result will be:
$ sed -i -f <(sed 's,^,/^,;s,$,:/d,' файл2) файл1 $ cat файл1 почта1:имя1:фамилия1:возраст1 почта3:имя3:фамилия3:возраст3 почта4:имя4:фамилия4:возраст4
just in case, I’ll clarify: when using the -i option of sed, a temporary file is actually created after all, and the results of processing the source file come into it. and at the end of processing, the original file is deleted, and the temporary file is renamed to the “original” name.