I am trying to combine 4 fastq.gz files in to one big file using following command.
cat *.fastq.gz > File_Big.fastq.gz
However Every time I got following error
Error: object '.fastq.gz' not found
I made sure that I am working in correct directory.
Anyone have any idea where I am going wrong?
Thanks
Do not use .fastq.gz for output extension if output is in same directory if you are running
cat *.fastq.gz > File_Big.fastq.gz
in shell. @ kam23leshThank you for the reply. I will keep this in mind.
Although it is better to be safe than sorry, most likely one won't have problems with
cat *.fastq.gz > File_Big.fastq.gz
. Bash-related shells first parse the glob, only then they create the output file. A little test:Now
cat a1.txt
shows:And
cat a1_n1.txt
shows:I performed the test above in bash and zsh, which I believe are the two most used shells currently.
C shells create the output file before parsing the glob, and indeed
cat *.fastq.gz > File_Big.fastq.gz
would cause a big problem, probably filling the disk.This works OK with
sh
too (sh
is POSIX compliant and the most hidden/painful of non C shells). However, I recommend against this as it can prove dangerous for beginners (or even pros with a few unknowns in shell config). In general, do not redirect an out or err stream to a file that matches a glob used by an in stream.What is the output of
ls -1 *.fastq.gz
? And the output ofls -1
?Sorry I am new to R.
I ran ls -1 *.fastq.gz and got following output Error: object '.fastq.gz' not found
Then I ran ls -1 and got following output Error in ls - 1 : non-numeric argument to binary operator
Ah, that explains so much. This doesn't go in R. This goes in your command line terminal.
Thank you for the help. Problem is resolved. I am able to combine it using terminal.
this is not R , this is bash.
Is there a space between your
*
and.fastq.gz
?No there is no space between * and .fastq.gz