I have been trying to solve a simple sed line deletion problem.
Looked here and there. It didn't solve my problem.
My problem could simply be achieved by using sed -i'{/^1\|^2\|^3/d;}' infile.txt which deletes lines beginning with 1,2 and 3 from the infile.txt.
But what I want instead is to take the starting matching patterns from a file than manually feeding into the stream editor.
E.g: deletePattern
1
3
2
infile.txt
1 Line here
2 Line here
3 Line here
4 Line here
Desired output
4 Line here
Thank you in advance,
deletepat.txtinto a string, and then try that string as the content of a character class insed. Something likewhile read -r ch; do a+=$ch; done <deletepat.txt. Thensed -i "{/^[$a]/d;}" infile.txt(note: you will need to test)