Question: dividing file into two files using cutoff value from a column?
0
gravatar for 1234anjalianjali1234
15 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 • 339 views
ADD COMMENTlink modified 15 months ago by JC12k • written 15 months ago by 1234anjalianjali123430

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

ADD REPLYlink written 15 months ago by RamRS30k

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 15 months ago • written 15 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 15 months ago by RamRS30k
3
gravatar for JC
15 months ago by
JC12k
Mexico
JC12k wrote:

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

ADD COMMENTlink written 15 months ago by JC12k

Thankyou, It worked.

ADD REPLYlink written 15 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: 1370 users visited in the last hour