This is a test version of Biostars. For the public version, visit https://www.biostars.org.
awk, copy and paste single line command

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

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

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?

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

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

1 answer

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.

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?

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?

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.

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

Log in to answer this question.