Biostar Beta. Not for public use.
Question: cat more than 2k files into 1 file
1
Entering edit mode

Hai all,

I am trying to cat more than 2k files (inside containing multiple sequences) into 1 file.

I used cat /.fasta > output.fasta.

(/ because all the files contain in directories).

But I got the error : Arguement too long.

Anyone please help me

ADD COMMENTlink 5.2 years ago peacezah • 10
Entering edit mode
0

Geek_y, still argument list too long.. :(

ADD REPLYlink 5.2 years ago
peacezah
• 10
Entering edit mode
0

Hello peacezah!

We believe that this post does not fit the main topic of this site.

not related to bioinformatics

For this reason we have closed your question. This allows us to keep the site focused on the topics that the community can help with.

If you disagree please tell us why in a reply below, we'll be happy to talk about it.

Cheers!

ADD REPLYlink 5.2 years ago
Pierre Lindenbaum
120k
Entering edit mode
0

Why should you close this? It`s related to computer as well.?

ADD REPLYlink 5.2 years ago
peacezah
• 10
Entering edit mode
0
I've closed this post as it's just a linux-related question. As an answer:

find ./ -name "*.fasta" | while read F; do cat ${F} >> result.txt; done
ADD REPLYlink 5.2 years ago
Pierre Lindenbaum
120k
Entering edit mode
0
Shortest way: find . -name \*fasta -exec cat {} \; > out.fa
ADD REPLYlink 5.2 years ago
Andreas
♦ 2.4k
0
Entering edit mode
Try this:
-n is the number of chunks it should allow once, and -p for number of cat jobs to run simultaneously.

ls */*.fasta | xargs -n <int chunks> -P <int jobs> cat >> output.fasta
ADD COMMENTlink 5.2 years ago geek_y 9.7k
Entering edit mode
1

While that would be safe with GNU Parallel, using -P with xargs is dangerous if you want to use the output: You are likely to end up with mixed lines. man parallel has this example showing the problem:

         parallel perl -e '\$a=\"1{}\"x10000000\;print\ \$a,\"\\n\"' '>' {} \
           ::: a b c d e f
         ls -l a b c d e f
         parallel -kP4 -n1 grep 1 > out.par ::: a b c d e f
         echo a b c d e f | xargs -P4 -n1 grep 1 > out.xargs-unbuf
         echo a b c d e f | \
           xargs -P4 -n1 grep --line-buffered 1 > out.xargs-linebuf
         echo a b c d e f | xargs -n1 grep 1 > out.xargs-serial
         ls -l out*
         md5sum out*
ADD REPLYlink 5.2 years ago
ole.tange
♦ 3.4k
This thread is not open. No new answers may be added
Similar Posts
Loading Similar Posts
Powered by the version 2.0