How to select rows in a given range?
Clash Royale CLAN TAG#URR8PPP
up vote
2
down vote
favorite
I have a file with 2 columns:
head positions_vcf
4 68264840
4 52784678
4 52788987
4 52795404
4 52800097
4 52801203
4 52804052
4 52804766
4 52804941
4 52805425
4 52807245
4 52809203
4 52809705
4 52810211
4 52810307
4 52811970
4 52812994
4 52814042
4 52814185
4 52815272
I need to select only rows in which the second column is within the range of "52804760-52809700".
my desired out_put
desired_output
4 52804766
4 52804941
4 52805425
4 52807245
4 52809203
text-processing grep
add a comment |Â
up vote
2
down vote
favorite
I have a file with 2 columns:
head positions_vcf
4 68264840
4 52784678
4 52788987
4 52795404
4 52800097
4 52801203
4 52804052
4 52804766
4 52804941
4 52805425
4 52807245
4 52809203
4 52809705
4 52810211
4 52810307
4 52811970
4 52812994
4 52814042
4 52814185
4 52815272
I need to select only rows in which the second column is within the range of "52804760-52809700".
my desired out_put
desired_output
4 52804766
4 52804941
4 52805425
4 52807245
4 52809203
text-processing grep
add a comment |Â
up vote
2
down vote
favorite
up vote
2
down vote
favorite
I have a file with 2 columns:
head positions_vcf
4 68264840
4 52784678
4 52788987
4 52795404
4 52800097
4 52801203
4 52804052
4 52804766
4 52804941
4 52805425
4 52807245
4 52809203
4 52809705
4 52810211
4 52810307
4 52811970
4 52812994
4 52814042
4 52814185
4 52815272
I need to select only rows in which the second column is within the range of "52804760-52809700".
my desired out_put
desired_output
4 52804766
4 52804941
4 52805425
4 52807245
4 52809203
text-processing grep
I have a file with 2 columns:
head positions_vcf
4 68264840
4 52784678
4 52788987
4 52795404
4 52800097
4 52801203
4 52804052
4 52804766
4 52804941
4 52805425
4 52807245
4 52809203
4 52809705
4 52810211
4 52810307
4 52811970
4 52812994
4 52814042
4 52814185
4 52815272
I need to select only rows in which the second column is within the range of "52804760-52809700".
my desired out_put
desired_output
4 52804766
4 52804941
4 52805425
4 52807245
4 52809203
text-processing grep
asked May 3 at 17:11
Anna1364
421110
421110
add a comment |Â
add a comment |Â
1 Answer
1
active
oldest
votes
up vote
3
down vote
accepted
Using awk
:
awk '$2 >= 52804760 && $2 <= 52809700' positions_vcf
2
or more awk-ishly:awk '$2 >= 52804760 && $2 <= 52809700'
â Jeff Schaller
May 3 at 17:16
1
For readability, I like to use this style:52804760 <= $2 && $2 <= 52809700
â glenn jackman
May 3 at 17:19
add a comment |Â
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
3
down vote
accepted
Using awk
:
awk '$2 >= 52804760 && $2 <= 52809700' positions_vcf
2
or more awk-ishly:awk '$2 >= 52804760 && $2 <= 52809700'
â Jeff Schaller
May 3 at 17:16
1
For readability, I like to use this style:52804760 <= $2 && $2 <= 52809700
â glenn jackman
May 3 at 17:19
add a comment |Â
up vote
3
down vote
accepted
Using awk
:
awk '$2 >= 52804760 && $2 <= 52809700' positions_vcf
2
or more awk-ishly:awk '$2 >= 52804760 && $2 <= 52809700'
â Jeff Schaller
May 3 at 17:16
1
For readability, I like to use this style:52804760 <= $2 && $2 <= 52809700
â glenn jackman
May 3 at 17:19
add a comment |Â
up vote
3
down vote
accepted
up vote
3
down vote
accepted
Using awk
:
awk '$2 >= 52804760 && $2 <= 52809700' positions_vcf
Using awk
:
awk '$2 >= 52804760 && $2 <= 52809700' positions_vcf
edited May 3 at 17:17
answered May 3 at 17:15
Jesse_b
10.3k22658
10.3k22658
2
or more awk-ishly:awk '$2 >= 52804760 && $2 <= 52809700'
â Jeff Schaller
May 3 at 17:16
1
For readability, I like to use this style:52804760 <= $2 && $2 <= 52809700
â glenn jackman
May 3 at 17:19
add a comment |Â
2
or more awk-ishly:awk '$2 >= 52804760 && $2 <= 52809700'
â Jeff Schaller
May 3 at 17:16
1
For readability, I like to use this style:52804760 <= $2 && $2 <= 52809700
â glenn jackman
May 3 at 17:19
2
2
or more awk-ishly:
awk '$2 >= 52804760 && $2 <= 52809700'
â Jeff Schaller
May 3 at 17:16
or more awk-ishly:
awk '$2 >= 52804760 && $2 <= 52809700'
â Jeff Schaller
May 3 at 17:16
1
1
For readability, I like to use this style:
52804760 <= $2 && $2 <= 52809700
â glenn jackman
May 3 at 17:19
For readability, I like to use this style:
52804760 <= $2 && $2 <= 52809700
â glenn jackman
May 3 at 17:19
add a comment |Â
Â
draft saved
draft discarded
Â
draft saved
draft discarded
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f441606%2fhow-to-select-rows-in-a-given-range%23new-answer', 'question_page');
);
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password