How do I extract a number from a row
Clash Royale CLAN TAG#URR8PPP
up vote
0
down vote
favorite
31400 371 2946 3966 12378 82 185 206 46 1
I want to write a script that will always extract the second number from a script like the one above i.e. 371
. The number changes each time I run the script. Any ideas what bash command to use to extract just the number 371
but that number could be anything.
text-processing awk sed numeric-data
add a comment |Â
up vote
0
down vote
favorite
31400 371 2946 3966 12378 82 185 206 46 1
I want to write a script that will always extract the second number from a script like the one above i.e. 371
. The number changes each time I run the script. Any ideas what bash command to use to extract just the number 371
but that number could be anything.
text-processing awk sed numeric-data
add a comment |Â
up vote
0
down vote
favorite
up vote
0
down vote
favorite
31400 371 2946 3966 12378 82 185 206 46 1
I want to write a script that will always extract the second number from a script like the one above i.e. 371
. The number changes each time I run the script. Any ideas what bash command to use to extract just the number 371
but that number could be anything.
text-processing awk sed numeric-data
31400 371 2946 3966 12378 82 185 206 46 1
I want to write a script that will always extract the second number from a script like the one above i.e. 371
. The number changes each time I run the script. Any ideas what bash command to use to extract just the number 371
but that number could be anything.
text-processing awk sed numeric-data
text-processing awk sed numeric-data
edited Aug 23 at 16:07
Jeff Schaller
32.7k849110
32.7k849110
asked Aug 23 at 15:40
Keiran Corbett
1
1
add a comment |Â
add a comment |Â
3 Answers
3
active
oldest
votes
up vote
4
down vote
This is exactly the sort of thing that awk
is for:
$ ./yourscript.sh | awk 'print $2'
371
add a comment |Â
up vote
0
down vote
Or
cut -f2 file
presumed the data are Tab separated.
add a comment |Â
up vote
0
down vote
Or
./yourscript.sh | read a b c; echo $b;
add a comment |Â
3 Answers
3
active
oldest
votes
3 Answers
3
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
4
down vote
This is exactly the sort of thing that awk
is for:
$ ./yourscript.sh | awk 'print $2'
371
add a comment |Â
up vote
4
down vote
This is exactly the sort of thing that awk
is for:
$ ./yourscript.sh | awk 'print $2'
371
add a comment |Â
up vote
4
down vote
up vote
4
down vote
This is exactly the sort of thing that awk
is for:
$ ./yourscript.sh | awk 'print $2'
371
This is exactly the sort of thing that awk
is for:
$ ./yourscript.sh | awk 'print $2'
371
answered Aug 23 at 15:42
DopeGhoti
41.1k55080
41.1k55080
add a comment |Â
add a comment |Â
up vote
0
down vote
Or
cut -f2 file
presumed the data are Tab separated.
add a comment |Â
up vote
0
down vote
Or
cut -f2 file
presumed the data are Tab separated.
add a comment |Â
up vote
0
down vote
up vote
0
down vote
Or
cut -f2 file
presumed the data are Tab separated.
Or
cut -f2 file
presumed the data are Tab separated.
edited Aug 23 at 16:43
ñÃÂsýù÷
15.8k92563
15.8k92563
answered Aug 23 at 16:27
RudiC
1,2168
1,2168
add a comment |Â
add a comment |Â
up vote
0
down vote
Or
./yourscript.sh | read a b c; echo $b;
add a comment |Â
up vote
0
down vote
Or
./yourscript.sh | read a b c; echo $b;
add a comment |Â
up vote
0
down vote
up vote
0
down vote
Or
./yourscript.sh | read a b c; echo $b;
Or
./yourscript.sh | read a b c; echo $b;
edited Aug 24 at 10:07
Jeff Schaller
32.7k849110
32.7k849110
answered Aug 24 at 7:33
Michael Vehrs
2,17037
2,17037
add a comment |Â
add a comment |Â
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%2f464435%2fhow-do-i-extract-a-number-from-a-row%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