Question: Command prompts combination
0
gravatar for K.Gee
9 months ago by
K.Gee30
K.Gee30 wrote:

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 • 245 views
ADD COMMENTlink modified 8 months ago • written 9 months ago by K.Gee30

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.

ADD REPLYlink written 9 months ago by Istvan Albert ♦♦ 85k

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.

ADD REPLYlink written 8 months ago by K.Gee30

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?

ADD REPLYlink written 8 months ago by K.Gee30
0
gravatar for tomc
9 months ago by
tomc80
United States
tomc80 wrote:

'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

ADD COMMENTlink written 9 months ago by tomc80
Please log in to add an answer.

Help
Access

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.
Powered by Biostar version 2.3.0
Traffic: 2056 users visited in the last hour