Linux GREP / SED [xargs] находит шаблон и номер строки в файлах и удаляет с помощью SED

Моя ситуация такова:

I have a very long text string, containing special characters, which occurs on a long line in various files. Files containing the string are throughout the file system (Linux). The string may be on various line numbers in the files where it occurs, but occurs once per file. The string, however, contains a specific pattern which I can key on for identification of the entire string.

I know how to find the names of files containing the string by keying on the 'prefix' of the string using GREP -lir mystringprefix /path.

I know how to determine the line number of the string in the file using GREP and SED using grep -n "prefix" file.name | sed -n “s/^([0-9])[:]./\1/p”.

I know how to use SED to delete in place the line in the file containing the string of interest using sed -i xd /path/file (x is the line number to be deleted).

Мой вопрос: как я могу собрать все это вместе, чтобы определить, какие файлы содержат шаблон, передать имя в GREP, чтобы определить номер строки в файле, а затем передать и имя, и номер строки в SED, чтобы удалить строку?

Мне нужно сделать это таким образом, чтобы начать в определенном месте в файловой системе, а затем выполнить его поиск / удаление рекурсивно.

Спасибо.

Ответы на вопрос(2)

Ваш ответ на вопрос