Hi community!!!
I have a metaphlan output 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?
I have used grep 's__' > extracted_file.txt
. But it does not keep the first two lines in the output. Here is an example of the output:
you can try
awk 'NR < 3 || /s__/{print}' stackoverflow.tsv
orsed -n '1,2p;/s__/p' stackoverflow.csv