TheFoxx
TheFoxx

Reputation: 1693

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

Upvotes: 0

Views: 511

Answers (2)

Thomas Padron-McCarthy
Thomas Padron-McCarthy

Reputation: 27632

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

Upvotes: 1

hd1
hd1

Reputation: 34657

Are the files zipped or GZipped? If the former, zcat won't do the task. You'll need unzip instead, with the following syntax:

unzip -p file1 | samtools view -bS - > outputfile

Upvotes: 0

Related Questions