Search code examples
unixzcat

How to use zcat as input to a function in the unix?


I have some very large files, and a server with not a lot of space, plus it takes so much time to unzip these files so I was hoping to use zcat as input to a function?

What I've been using is

$ zcat file1 | samtools view -bS > outputfile

file1 is the zipped file, and the outputfile is obviously the output of the view function in samtools. The input to samtools usually goes between the -bS and the >

What I have above isn't working, any help? Thanks


Solution

  • You may need to give "-" as argument to samtools, to get it to read from standard input instead of a file:

    zcat file1 | samtools view -bS - > outputfile