Print numbers from tablecompare multiple files(more than two) with two different columnsjoin two files based...
Shorten or merge multiple lines of `&> /dev/null &`
Why isn't 'chemically-strengthened glass' made with potassium carbonate? To begin with?
Burned out due to current job, Can I take a week of vacation between jobs?
Why does Bran want to find Drogon?
Navigating a quick return to previous employer
Why is 'additive' EQ more difficult to use than 'subtractive'?
How does the Earth's center produce heat?
Can you still travel to America on the ESTA waiver program if you have been to Iran in transit?
Testing using real data of the customer
Does an eye for an eye mean monetary compensation?
Possibility of faking someone's public key
Can a ring of spell storing and access to Find spells produce an endless menagerie?
Why do Russians almost not use verbs of possession akin to "have"?
Finding all files with a given extension whose base name is the name of the parent directory
Variable declaraton with extra in C
Why does the hash of infinity have the digits of π?
Dad jokes are fun
Security vulnerabilities of POST over SSL
How to melt snow without fire or using body heat?
Sorting with IComparable design
Creating second map without labels using QGIS?
Low voltage shutdown with regulator using microcontroller
What were the Ethiopians doing in Xerxes' army?
Can we assume that a hash function with high collision resistance also means highly uniform distribution?
Print numbers from table
compare multiple files(more than two) with two different columnsjoin two files based on column when there is no one-to-one correspondence in bash script (awk, grep , sed)how to increment a column value with 1 in a csv fileHow to print next nth column in current line after pattern match?Print values which are at least 2 times larger than the values 3 steps above and below in the same columnmatch two columns from one file to three columns from another file, print out lines from the file with two columnsawk print most common string in second columnMatch pattern in a file and print the matching word (not the whole line) in second columnPrinting one column from one file - awkHow to print from second row after match?
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty{ margin-bottom:0;
}
How to get four numbers from this table please?
Input:
chil 2 44843.084886752418 44843.080972494339 0.38261625919046571
o 0 1 0 1 1 5.732820000 0.000 = PERIOD(0)
o 0 2 0 1 1 54002.864912732 0.000 = PERIASTRON EPOCH
o 0 3 0 1 1 0.086796671 0.000 = ECCENTRICITY
o 0 4 0 1 1 151.562809500 0.020 = PERIASTRON LONG.
o 0 5 0 1 1 107.927001263 0.053 = K1
o 0 6 0 1 1 0.418206121 0.000 = q = M2/M1, K2 = 258.071309
o 0 7 0 1 1 0.004220000 0.000 = d omega/dt
o 0 8 0 1 1 0.000000000 0.100 = d P/dt
o 0 9 0 1 1 0.000000000 0.100 = d e/dt
o 0 10 0 1 1 0.000000000 0.100 = d K1/dt
o 0 11 0 1 1 0.000000000 0.100 = d q/dt
o 2 1 0 1 1 99000.000000000 1650.000 = PERIOD(2)
o 2 2 0 1 1 39254.892879388 -984.000 = PERIASTRON EPOCH
o 2 3 0 1 1 0.770000000 0.010 = ECCENTRICITY
o 2 4 0 1 1 68.284996369 -6.000 = PERIASTRON LONG.
Desired output
0.086796671
151.562809500
107.927001263
0.418206121
I unsuccessfully tried
/o 0 1 0 1 1 5.732820000 0.000 = PERIOD(0)/ { c=FNR;}
(FNR-c>=2 && c>0) {$2 ~ /<0>/ $3 ~ /<3|4|5|6>/ { print $7}
I want to say: If second column is 0 and the third colums is 3,4,5,6 print column 7
awk
add a comment |
How to get four numbers from this table please?
Input:
chil 2 44843.084886752418 44843.080972494339 0.38261625919046571
o 0 1 0 1 1 5.732820000 0.000 = PERIOD(0)
o 0 2 0 1 1 54002.864912732 0.000 = PERIASTRON EPOCH
o 0 3 0 1 1 0.086796671 0.000 = ECCENTRICITY
o 0 4 0 1 1 151.562809500 0.020 = PERIASTRON LONG.
o 0 5 0 1 1 107.927001263 0.053 = K1
o 0 6 0 1 1 0.418206121 0.000 = q = M2/M1, K2 = 258.071309
o 0 7 0 1 1 0.004220000 0.000 = d omega/dt
o 0 8 0 1 1 0.000000000 0.100 = d P/dt
o 0 9 0 1 1 0.000000000 0.100 = d e/dt
o 0 10 0 1 1 0.000000000 0.100 = d K1/dt
o 0 11 0 1 1 0.000000000 0.100 = d q/dt
o 2 1 0 1 1 99000.000000000 1650.000 = PERIOD(2)
o 2 2 0 1 1 39254.892879388 -984.000 = PERIASTRON EPOCH
o 2 3 0 1 1 0.770000000 0.010 = ECCENTRICITY
o 2 4 0 1 1 68.284996369 -6.000 = PERIASTRON LONG.
Desired output
0.086796671
151.562809500
107.927001263
0.418206121
I unsuccessfully tried
/o 0 1 0 1 1 5.732820000 0.000 = PERIOD(0)/ { c=FNR;}
(FNR-c>=2 && c>0) {$2 ~ /<0>/ $3 ~ /<3|4|5|6>/ { print $7}
I want to say: If second column is 0 and the third colums is 3,4,5,6 print column 7
awk
Please describe the rule.
– dedowsdi
46 mins ago
I editted the question
– Lukáš Altman
33 mins ago
But second column of your desired output are all0
.
– dedowsdi
28 mins ago
Yes, I am sorry
– Lukáš Altman
21 mins ago
add a comment |
How to get four numbers from this table please?
Input:
chil 2 44843.084886752418 44843.080972494339 0.38261625919046571
o 0 1 0 1 1 5.732820000 0.000 = PERIOD(0)
o 0 2 0 1 1 54002.864912732 0.000 = PERIASTRON EPOCH
o 0 3 0 1 1 0.086796671 0.000 = ECCENTRICITY
o 0 4 0 1 1 151.562809500 0.020 = PERIASTRON LONG.
o 0 5 0 1 1 107.927001263 0.053 = K1
o 0 6 0 1 1 0.418206121 0.000 = q = M2/M1, K2 = 258.071309
o 0 7 0 1 1 0.004220000 0.000 = d omega/dt
o 0 8 0 1 1 0.000000000 0.100 = d P/dt
o 0 9 0 1 1 0.000000000 0.100 = d e/dt
o 0 10 0 1 1 0.000000000 0.100 = d K1/dt
o 0 11 0 1 1 0.000000000 0.100 = d q/dt
o 2 1 0 1 1 99000.000000000 1650.000 = PERIOD(2)
o 2 2 0 1 1 39254.892879388 -984.000 = PERIASTRON EPOCH
o 2 3 0 1 1 0.770000000 0.010 = ECCENTRICITY
o 2 4 0 1 1 68.284996369 -6.000 = PERIASTRON LONG.
Desired output
0.086796671
151.562809500
107.927001263
0.418206121
I unsuccessfully tried
/o 0 1 0 1 1 5.732820000 0.000 = PERIOD(0)/ { c=FNR;}
(FNR-c>=2 && c>0) {$2 ~ /<0>/ $3 ~ /<3|4|5|6>/ { print $7}
I want to say: If second column is 0 and the third colums is 3,4,5,6 print column 7
awk
How to get four numbers from this table please?
Input:
chil 2 44843.084886752418 44843.080972494339 0.38261625919046571
o 0 1 0 1 1 5.732820000 0.000 = PERIOD(0)
o 0 2 0 1 1 54002.864912732 0.000 = PERIASTRON EPOCH
o 0 3 0 1 1 0.086796671 0.000 = ECCENTRICITY
o 0 4 0 1 1 151.562809500 0.020 = PERIASTRON LONG.
o 0 5 0 1 1 107.927001263 0.053 = K1
o 0 6 0 1 1 0.418206121 0.000 = q = M2/M1, K2 = 258.071309
o 0 7 0 1 1 0.004220000 0.000 = d omega/dt
o 0 8 0 1 1 0.000000000 0.100 = d P/dt
o 0 9 0 1 1 0.000000000 0.100 = d e/dt
o 0 10 0 1 1 0.000000000 0.100 = d K1/dt
o 0 11 0 1 1 0.000000000 0.100 = d q/dt
o 2 1 0 1 1 99000.000000000 1650.000 = PERIOD(2)
o 2 2 0 1 1 39254.892879388 -984.000 = PERIASTRON EPOCH
o 2 3 0 1 1 0.770000000 0.010 = ECCENTRICITY
o 2 4 0 1 1 68.284996369 -6.000 = PERIASTRON LONG.
Desired output
0.086796671
151.562809500
107.927001263
0.418206121
I unsuccessfully tried
/o 0 1 0 1 1 5.732820000 0.000 = PERIOD(0)/ { c=FNR;}
(FNR-c>=2 && c>0) {$2 ~ /<0>/ $3 ~ /<3|4|5|6>/ { print $7}
I want to say: If second column is 0 and the third colums is 3,4,5,6 print column 7
awk
awk
edited 21 mins ago
Lukáš Altman
asked 54 mins ago
Lukáš AltmanLukáš Altman
855
855
Please describe the rule.
– dedowsdi
46 mins ago
I editted the question
– Lukáš Altman
33 mins ago
But second column of your desired output are all0
.
– dedowsdi
28 mins ago
Yes, I am sorry
– Lukáš Altman
21 mins ago
add a comment |
Please describe the rule.
– dedowsdi
46 mins ago
I editted the question
– Lukáš Altman
33 mins ago
But second column of your desired output are all0
.
– dedowsdi
28 mins ago
Yes, I am sorry
– Lukáš Altman
21 mins ago
Please describe the rule.
– dedowsdi
46 mins ago
Please describe the rule.
– dedowsdi
46 mins ago
I editted the question
– Lukáš Altman
33 mins ago
I editted the question
– Lukáš Altman
33 mins ago
But second column of your desired output are all
0
.– dedowsdi
28 mins ago
But second column of your desired output are all
0
.– dedowsdi
28 mins ago
Yes, I am sorry
– Lukáš Altman
21 mins ago
Yes, I am sorry
– Lukáš Altman
21 mins ago
add a comment |
2 Answers
2
active
oldest
votes
Your command can be just simplified to just below. You were missing a group operator to combine conditions to match values from $2
and $3
. You can put them together with a &&
awk '$NF == "PERIOD(0)" { c=FNR; }
( FNR-c>=2 && c>0 ) && ( $2 ~ /<0>/ && $3 ~ /<3|4|5|6>/ ) { print $7 }' file
I got these numbers 54002.864912732 0.086796671 151.562809500 107.927001263 39254.892879388 0.770000000 68.284996369 3.000000000 and lots of spaces.
– Lukáš Altman
13 mins ago
@LukášAltman: I copy pasted your input in question and ran the command which produced the output as expected. You need to show us the actual file you are running this command on
– Inian
11 mins ago
add a comment |
awk '$2==0 && $3~/^[3456]$/{print $7}' data
add a comment |
Your Answer
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "106"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
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
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f520308%2fprint-numbers-from-table%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
Your command can be just simplified to just below. You were missing a group operator to combine conditions to match values from $2
and $3
. You can put them together with a &&
awk '$NF == "PERIOD(0)" { c=FNR; }
( FNR-c>=2 && c>0 ) && ( $2 ~ /<0>/ && $3 ~ /<3|4|5|6>/ ) { print $7 }' file
I got these numbers 54002.864912732 0.086796671 151.562809500 107.927001263 39254.892879388 0.770000000 68.284996369 3.000000000 and lots of spaces.
– Lukáš Altman
13 mins ago
@LukášAltman: I copy pasted your input in question and ran the command which produced the output as expected. You need to show us the actual file you are running this command on
– Inian
11 mins ago
add a comment |
Your command can be just simplified to just below. You were missing a group operator to combine conditions to match values from $2
and $3
. You can put them together with a &&
awk '$NF == "PERIOD(0)" { c=FNR; }
( FNR-c>=2 && c>0 ) && ( $2 ~ /<0>/ && $3 ~ /<3|4|5|6>/ ) { print $7 }' file
I got these numbers 54002.864912732 0.086796671 151.562809500 107.927001263 39254.892879388 0.770000000 68.284996369 3.000000000 and lots of spaces.
– Lukáš Altman
13 mins ago
@LukášAltman: I copy pasted your input in question and ran the command which produced the output as expected. You need to show us the actual file you are running this command on
– Inian
11 mins ago
add a comment |
Your command can be just simplified to just below. You were missing a group operator to combine conditions to match values from $2
and $3
. You can put them together with a &&
awk '$NF == "PERIOD(0)" { c=FNR; }
( FNR-c>=2 && c>0 ) && ( $2 ~ /<0>/ && $3 ~ /<3|4|5|6>/ ) { print $7 }' file
Your command can be just simplified to just below. You were missing a group operator to combine conditions to match values from $2
and $3
. You can put them together with a &&
awk '$NF == "PERIOD(0)" { c=FNR; }
( FNR-c>=2 && c>0 ) && ( $2 ~ /<0>/ && $3 ~ /<3|4|5|6>/ ) { print $7 }' file
edited 11 mins ago
answered 17 mins ago
InianInian
5,8681633
5,8681633
I got these numbers 54002.864912732 0.086796671 151.562809500 107.927001263 39254.892879388 0.770000000 68.284996369 3.000000000 and lots of spaces.
– Lukáš Altman
13 mins ago
@LukášAltman: I copy pasted your input in question and ran the command which produced the output as expected. You need to show us the actual file you are running this command on
– Inian
11 mins ago
add a comment |
I got these numbers 54002.864912732 0.086796671 151.562809500 107.927001263 39254.892879388 0.770000000 68.284996369 3.000000000 and lots of spaces.
– Lukáš Altman
13 mins ago
@LukášAltman: I copy pasted your input in question and ran the command which produced the output as expected. You need to show us the actual file you are running this command on
– Inian
11 mins ago
I got these numbers 54002.864912732 0.086796671 151.562809500 107.927001263 39254.892879388 0.770000000 68.284996369 3.000000000 and lots of spaces.
– Lukáš Altman
13 mins ago
I got these numbers 54002.864912732 0.086796671 151.562809500 107.927001263 39254.892879388 0.770000000 68.284996369 3.000000000 and lots of spaces.
– Lukáš Altman
13 mins ago
@LukášAltman: I copy pasted your input in question and ran the command which produced the output as expected. You need to show us the actual file you are running this command on
– Inian
11 mins ago
@LukášAltman: I copy pasted your input in question and ran the command which produced the output as expected. You need to show us the actual file you are running this command on
– Inian
11 mins ago
add a comment |
awk '$2==0 && $3~/^[3456]$/{print $7}' data
add a comment |
awk '$2==0 && $3~/^[3456]$/{print $7}' data
add a comment |
awk '$2==0 && $3~/^[3456]$/{print $7}' data
awk '$2==0 && $3~/^[3456]$/{print $7}' data
edited 2 mins ago
answered 17 mins ago
dedowsdidedowsdi
43415
43415
add a comment |
add a comment |
Thanks for contributing an answer to Unix & Linux Stack Exchange!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
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
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f520308%2fprint-numbers-from-table%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
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
Required, but never shown
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
Required, but never shown
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
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Please describe the rule.
– dedowsdi
46 mins ago
I editted the question
– Lukáš Altman
33 mins ago
But second column of your desired output are all
0
.– dedowsdi
28 mins ago
Yes, I am sorry
– Lukáš Altman
21 mins ago