Issue
I want to search multiple strings in the same file So far I have this working but one string only
sed -n '/XXX/,+1p' FILE > FILE
sed -n '/XXX/YYY/ZZZ/,+1p' FILE > FILE
I could not make it work.
Solution
Use \|
to separate multiple patterns to match.
sed -n '/XXX\|YYY\|ZZZ/,+1p' INFILE > OUTFILE
Also, the input file has to be different from the output file (if you want to overwrite the file you should use the -i
option rather than redirecting to the input file).
Answered By - Barmar Answer Checked By - Katrina (WPSolving Volunteer)