Command prompts combination
1
0
Entering edit mode
4.9 years ago
K.Gee ▴ 40

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 • 969 views
ADD COMMENT
0
Entering edit mode

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 REPLY
0
Entering edit mode

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 REPLY
0
Entering edit mode

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 REPLY
0
Entering edit mode
4.9 years ago
tomc ▴ 90

'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 COMMENT

Login before adding your answer.

Traffic: 2288 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6