Question: (Closed) awk help to print lines when the columns are non zeros
0
gravatar for compugene
11 days ago by
compugene0
United States
compugene0 wrote:

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 • 117 views
ADD COMMENTlink modified 11 days ago by Ram12k • written 11 days ago by compugene0

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!

ADD REPLYlink written 11 days ago by Ram12k

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.

ADD REPLYlink modified 11 days ago by Ram12k • written 11 days ago by compugene0
1

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.

ADD REPLYlink written 11 days ago by Ram12k

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

ADD REPLYlink modified 11 days ago • written 11 days ago by compugene0
1

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.

ADD REPLYlink modified 11 days ago • written 11 days ago by Ram12k

Ok sure, thanks Kshama.

ADD REPLYlink written 11 days ago by compugene0
Please log in to add an answer.
The thread is closed. No new answers may be added.

Help
Access

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