awk, copy and paste single line command
1
1
Entering edit mode
4.7 years ago
3335098459 ▴ 30

Hi

I am just a beginner in the command line and newly introduced to Linux.

I am using software that suggested the following command to convert all the coordinates to plot.

cat <(echo "#CHR SNP BP minLOG10(P) log10(p) r^2") \\ <(paste <(sed '1d' penicillin_SNPs.txt | cut -d "_" -f 2) \\ <(sed '1d' penicillin_SNPs.txt | cut -f 4) | \\ awk '{p = -log($2)/log(10); print "26",".",$1,p,p,"0"}' ) | \\ tr ' ' '\t' > penicillin_snps.plot

Whenever I run this command, I am getting multiple errors

Cat: / dev / FD / 63: no file or directory

Cat: '\': no file or directory

Cat: / dev / FD / 62: no file or directory

Paste: / dev / FD / 62: no file or directory

\: command not found

\: command not found

I don't know the cause of this problem.

Thanks

software error • 2.1k views
ADD COMMENT
1
Entering edit mode

Just remove all these \\ in your command line should fix it.

ADD REPLY
0
Entering edit mode

Thanks but removing these \ solved the last two errors but the errors related to cat and paste are still there

Cat: / dev / FD / 63: no file or directory

Cat: / dev / FD / 62: no file or directory

Paste: / dev / FD / 62: no file or directory

how can I solve these?

ADD REPLY
1
Entering edit mode

can you post the output of head penicillin_SNPs.txt , so that we can have a look what is in this file?

ADD REPLY
0
Entering edit mode

Run the command in the directory where you actually have the files referred by the command?

ADD REPLY
3
Entering edit mode
4.7 years ago
michael.ante ★ 3.8k

Edit ( Kevin Blighe ): scroll down to see answer by OP

--------------------

In one cut call, you use "_" as delim char, in the other you don't.

If you get errors like this, dissect your one-liner in the single steps. Try first, what your sed .. | cut steps result in , maybe using .. | head to control the first lines. Then test the paste call.

Personally, I would try to solve the whole issue with one awk call.

ADD COMMENT
0
Entering edit mode

Yes you are right. This is the complete command divided into different sections by \ I guess.

cat <(echo "#CHR SNP BP minLOG10(P) log10(p) r^2") \\\

<(paste <(sed '1d' penicillin_SNPs.txt | cut -d "_" -f 2) \\\

<(sed '1d' penicillin_SNPs.txt | cut -f 4) | \\\

awk '{p = -log($2)/log(10); print "26",".",$1,p,p,"0"}' ) | \\\

tr ' ' '\t' > penicillin_snps.plot

From which point I should start if I am going to do it one by one?

ADD REPLY
0
Entering edit mode

From the most inner steps (the sed '1d' penicillin_SNPs.txt | cut -d "_" -f 2 and sed '1d' penicillin_SNPs.txt | cut -f 4 ) .

Looking at your code: you have <(paste <(sed ...) <(sed ..) | awk '{}') should the awk command not be used after the paste output?

ADD REPLY
0
Entering edit mode

Thanks for pointing out the possible solution. I have used the following command to solve this problem.

(sed '1d' penicilin_SNPs.txt | cut -d "_" -f 2, 4) | awk '{}' > example.txt

I also did some manual changes and it worked.

ADD REPLY
0
Entering edit mode

correct linux cmdline syntax it should only be a single \ (so not a double!), but that is indeed used as a separator to be able to write a cmdline on several lines in your terminal

ADD REPLY

Login before adding your answer.

Traffic: 1540 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