I have a file from where I want to extract the first two lines (starting with "ID" and "#SampleID") along with all the lines that contain "s__" in that line. And, want to put them in a new file. Can anyone please tell me how can I do that?
grep -m2 "" your.file > test.txt; grep "s__" your.file >> test.txt
awk 'NR<3 || /s__/' yourfile > newfile
или
sed -n -e '1,2p' -e '/s__/p' yourfile > newfile