This is a test version of Biostars. For the public version, visit https://www.biostars.org.
Command prompts combination

Hello! I have some "weird" txt.files and I found this way to manipulate them.
I use in combination csplit (generates couple of txt files) and join to obtain my desired output. My question is: Is it anyway to combine them in one command?

Im giving you my commands.

csplit -z qrna_ref.txt /AA_QUERY/ {*} -f area.txt  --> generates in this case 4 files named area.txt

join -a1 area.txt00  area.txt01 |join - area.txt02 |join - area.txt03 | join - area.txt04

I tried csplit -z qrna_ref.txt /AA_QUERY/ {*} -f area.txt && join -a1 area.txt00 area.txt01 |join - area.txt02 |join - area.txt03 | join - area.txt04 but it doesnt work...

Thanks in advance!

linux

Hello K.Gee!

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

Not 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!

No its fine!!! I respect that. Iam apologizing for that.

It is not clear what you are saying here, the commands do work separately but not when giving the command together?

In what way does it not work?

Do one step at a time, see if you can get it to work - most importantly the files need to be sorted by the field that you join on.

Yes exactly. In combination those two commands are not working together. Because the csplit gives an output of 4 files and I was trying to avoid having 4 files as an output and find the way to gave one output file at the end. That was the purpose of my question.

Maybe i didn't specify my question. I was trying to avoid having 4 output files at the end, so I was looking if by combining those 2 commands, so as to have one final output instead of 4. But I get your point. So if I understand what your are saying I should try some like: csplit -z qrna_ref.txt /AA_QUERY/ {*} -f area.txt ; cat area.txt00 area.txt01 area.txt02 area.txt03 area.txt04 >out.txt

For having one output file?

1 answer

'join' is oriented to match columns within a row (as 'join' in relational databases), not to concatenate chunks of rows as you have here. for that use 'cat'

cat area.txt0* > out.txt

Log in to answer this question.