Friday, January 15, 2016

Merging two or more SAM files in Unix

To merge two SAM files in Unix use simple cat piped to awk to eliminate lines that start with @

cp file1.sam merged.sam
cat file2.sam | awk '$1 !~ /@/' >> merged.sam