My situation is:
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).
My question is how can I put all this together to determine which files contain the pattern, pass the name to GREP to determine the line number in the file, then pass both the name and line number to SED to remove the line?
I need to do this in such a way as to start in a certain location in the filesystem then have it search/delete recursively.
Thank you.