This is a test version of Biostars. For the public version, visit https://www.biostars.org.
awk help to print lines when the columns are non zeros

Hi I have a file with the following format:

filename is foo.txt

abcd 1 0 0 2
abef 2 0 0 0
able 2 1 2 0
able 1 0 0 0
efgh 0 0 0 0

I wrote an awk script to delete the row with all columns with 0. But I am getting syntax error. SO I am sure this is very simple.

Please can anytime help me fix this?

awk 'BEGIN{i=1; While($2==0)($3==0)($4==0) {print $0} }' foo.txt
next-gen

Hello compugene!

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

Not a bioinformatics question

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!

I disagree.

When we get transcripts count file from htseq or refseq etc,it spits out genenames with columns of a value. We would then go ahead and delete lines which has zeros across all columns.

I did not want to post my data set and values on the post and hence gave random names.

It is bioinformatics text processing and hence extremely relevant.

Please post it back on.

Much appreciated,

Thanks.

You should have mentioned this part on transcript counts. We can only work with the context you give us. You said you have a "file" with some kind of data in it that you wish to process with a generic unix tool - how does this relate to bioinformatics?

Strictly speaking, unless it needs some sort of domain knowledge, this is just plain text processing. Text processing is a large part of what we do, but just because something is text processing does not make it bioinformatics.

The onus is on you to make a question relate to bioinformatics, not on moderators to imagine how random posts could be bioinformatics.

Also to add to my previous email. There is tons of text processing that happens in NGS and it is important to somehow link computational questions to bioinformatics/ngs portal. If this does not fit the realm currently, I strongly feel one should come up with one such,unless there is a portal already. Thanks Best

Yes, there is, but stackoverflow and other sites already address most text processing challenges. A quick google turned up a result to an expanded version of your question: https://stackoverflow.com/questions/37976535/awk-unix-command-how-to-delete-rows-when-multiple-column-having-zero-values

To reiterate, please edit your question and give some context to establish your post as relating to bioinformatics, and then your question will be reopened.

0 answers

No answers yet.

Log in to answer this question.