Question: dividing file into two files using cutoff value from a column?
0
gravatar for 1234anjalianjali1234
5 months ago by
India
1234anjalianjali123430 wrote:

Hi,

I have a FILE:

BINPACKER    protein_Rf1    25.947  1.94e-31     N/A    N/A   quinoa
BINPACKER    mitochondrial  50.947  1.94e-31     N/A    N/A   quinoa

I want to divide this file based on the value in column 3 (e.g value >=50 in one file and others i.e. < 50 in other file) retaining all the columns.

Thankyou

linux shell terminal ubuntu • 240 views
ADD COMMENTlink modified 5 months ago by JC9.3k • written 5 months ago by 1234anjalianjali123430

What have you tried? This is pretty straightforward to do in awk.

ADD REPLYlink written 5 months ago by RamRS25k

cat myfile.txt | awk '$3 > 50' > file_greater_than50.txt

But It is not working and also I don't how to apply =< criteria.

ADD REPLYlink modified 5 months ago • written 5 months ago by 1234anjalianjali123430
1

Please specify a delimiter for awk using awk -F or awk 'BEGIN { IFS=...'. >= is applied using the >= operator.

ADD REPLYlink written 5 months ago by RamRS25k
3
gravatar for JC
5 months ago by
JC9.3k
Mexico
JC9.3k wrote:

perl -lane 'print if ($F[2] >=50)' < input > output

ADD COMMENTlink written 5 months ago by JC9.3k

Thankyou, It worked.

ADD REPLYlink written 5 months ago by 1234anjalianjali123430
Please log in to add an answer.

Help
Access

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