Determine Missing DIMM2019 Community Moderator ElectionWorking with columns - awk and sedReplacing missing value blank space with zeroawk: Extracting a fixed number of rows where the last row number may varyInsert missing string in multiple ordered columnsTranspose a file, and replace missing valuesFinding a missing sequential number in a data fileassign number of output lines to a variableMore efficient way of finding missing numberhow to avoid writing failed bash commands to bash_historyExtract multiple lines if match
Probability that THHT occurs in a sequence of 10 coin tosses
How to cover method return statement in Apex Class?
Terse Method to Swap Lowest for Highest?
How to explain what's wrong with this application of the chain rule?
Calculating total slots
Can a College of Swords bard use a Blade Flourish option on an opportunity attack provoked by their own Dissonant Whispers spell?
It grows, but water kills it
Why is the "ls" command showing permissions of files in a FAT32 partition?
Keeping a ball lost forever
How are Fiends, Celestials, dragons, etc. affected by the Antimagic Field spell?
When were female captains banned from Starfleet?
Does an advisor owe his/her student anything? Will an advisor keep a PhD student only out of pity?
What is going on with 'gets(stdin)' on the site coderbyte?
Mimic lecturing on blackboard, facing audience
Does Doodling or Improvising on the Piano Have Any Benefits?
How can "mimic phobia" be cured or prevented?
Is there a way to get `mathscr' with lower case letters in pdfLaTeX?
Redundant comparison & "if" before assignment
Calculate sum of polynomial roots
Add big quotation marks inside my colorbox
What if a revenant (monster) gains fire resistance?
Yosemite Fire Rings - What to Expect?
How to say when an application is taking the half of your screen on a computer
Why is so much work done on numerical verification of the Riemann Hypothesis?
Determine Missing DIMM
2019 Community Moderator ElectionWorking with columns - awk and sedReplacing missing value blank space with zeroawk: Extracting a fixed number of rows where the last row number may varyInsert missing string in multiple ordered columnsTranspose a file, and replace missing valuesFinding a missing sequential number in a data fileassign number of output lines to a variableMore efficient way of finding missing numberhow to avoid writing failed bash commands to bash_historyExtract multiple lines if match
When a memory module in one of my servers fails the event log will often report the wrong DIMM slot or a non existent DIMM slot altogether. The best way we have come up with to determine the failed DIMM is by checking for which one is missing.
I have a command that produces the following output:
Location Tag: P1-DIMMA1 Size: 34359738368 bytes
Location Tag: P1-DIMMA2
Location Tag: P1-DIMMB1
Location Tag: P1-DIMMC1
Location Tag: P1-DIMMD1 Size: 34359738368 bytes
Location Tag: P1-DIMMD2
Location Tag: P1-DIMME1 Size: 34359738368 bytes
Location Tag: P1-DIMMF1
Location Tag: P2-DIMMA1 Size: 34359738368 bytes
Location Tag: P2-DIMMA2
Location Tag: P2-DIMMB1 Size: 34359738368 bytes
Location Tag: P2-DIMMC1
Location Tag: P2-DIMMD1 Size: 34359738368 bytes
Location Tag: P2-DIMMD2
Location Tag: P2-DIMME1 Size: 34359738368 bytes
Location Tag: P2-DIMMF1
In this example P1-DIMMB1 is failed (that DIMM slot is populated in P2 but not P1)
I am looking for a programmatic method to determine which DIMM slot(s) is/are empty in one cpu but not the other. I have come up with the following bash monstrocity to accomplish this but I am sure there is a more simple way to accomplish this with awk
.
cpu1_dimms=()
cpu2_dimms=()
missing=()
while read -r line; do
dimm=$(awk 'print $3' <<<"$line")
cpu=$dimm:1:1
size=$(awk 'print $5' <<<"$line")
if [[ -n "$size" ]]; then
case $cpu in
1) cpu1_dimms+=( "$dimm:3" );;
2) cpu2_dimms+=( "$dimm:3" );;
esac
fi
done < <(echo "$var")
for dimm in "$cpu1_dimms[@]"; do
if ! [[ "$cpu2_dimms[@]" =~ "$dimm" ]]; then
missing+=( "P2-$dimm" )
fi
done
for dimm in "$cpu2_dimms[@]"; do
if ! [[ "$cpu1_dimms[@]" =~ "$dimm" ]]; then
missing+=( "P1-$dimm" )
fi
done
This assumes that the output of the aforementioned command is stored in the variable var
bash text-processing awk
add a comment |
When a memory module in one of my servers fails the event log will often report the wrong DIMM slot or a non existent DIMM slot altogether. The best way we have come up with to determine the failed DIMM is by checking for which one is missing.
I have a command that produces the following output:
Location Tag: P1-DIMMA1 Size: 34359738368 bytes
Location Tag: P1-DIMMA2
Location Tag: P1-DIMMB1
Location Tag: P1-DIMMC1
Location Tag: P1-DIMMD1 Size: 34359738368 bytes
Location Tag: P1-DIMMD2
Location Tag: P1-DIMME1 Size: 34359738368 bytes
Location Tag: P1-DIMMF1
Location Tag: P2-DIMMA1 Size: 34359738368 bytes
Location Tag: P2-DIMMA2
Location Tag: P2-DIMMB1 Size: 34359738368 bytes
Location Tag: P2-DIMMC1
Location Tag: P2-DIMMD1 Size: 34359738368 bytes
Location Tag: P2-DIMMD2
Location Tag: P2-DIMME1 Size: 34359738368 bytes
Location Tag: P2-DIMMF1
In this example P1-DIMMB1 is failed (that DIMM slot is populated in P2 but not P1)
I am looking for a programmatic method to determine which DIMM slot(s) is/are empty in one cpu but not the other. I have come up with the following bash monstrocity to accomplish this but I am sure there is a more simple way to accomplish this with awk
.
cpu1_dimms=()
cpu2_dimms=()
missing=()
while read -r line; do
dimm=$(awk 'print $3' <<<"$line")
cpu=$dimm:1:1
size=$(awk 'print $5' <<<"$line")
if [[ -n "$size" ]]; then
case $cpu in
1) cpu1_dimms+=( "$dimm:3" );;
2) cpu2_dimms+=( "$dimm:3" );;
esac
fi
done < <(echo "$var")
for dimm in "$cpu1_dimms[@]"; do
if ! [[ "$cpu2_dimms[@]" =~ "$dimm" ]]; then
missing+=( "P2-$dimm" )
fi
done
for dimm in "$cpu2_dimms[@]"; do
if ! [[ "$cpu1_dimms[@]" =~ "$dimm" ]]; then
missing+=( "P1-$dimm" )
fi
done
This assumes that the output of the aforementioned command is stored in the variable var
bash text-processing awk
add a comment |
When a memory module in one of my servers fails the event log will often report the wrong DIMM slot or a non existent DIMM slot altogether. The best way we have come up with to determine the failed DIMM is by checking for which one is missing.
I have a command that produces the following output:
Location Tag: P1-DIMMA1 Size: 34359738368 bytes
Location Tag: P1-DIMMA2
Location Tag: P1-DIMMB1
Location Tag: P1-DIMMC1
Location Tag: P1-DIMMD1 Size: 34359738368 bytes
Location Tag: P1-DIMMD2
Location Tag: P1-DIMME1 Size: 34359738368 bytes
Location Tag: P1-DIMMF1
Location Tag: P2-DIMMA1 Size: 34359738368 bytes
Location Tag: P2-DIMMA2
Location Tag: P2-DIMMB1 Size: 34359738368 bytes
Location Tag: P2-DIMMC1
Location Tag: P2-DIMMD1 Size: 34359738368 bytes
Location Tag: P2-DIMMD2
Location Tag: P2-DIMME1 Size: 34359738368 bytes
Location Tag: P2-DIMMF1
In this example P1-DIMMB1 is failed (that DIMM slot is populated in P2 but not P1)
I am looking for a programmatic method to determine which DIMM slot(s) is/are empty in one cpu but not the other. I have come up with the following bash monstrocity to accomplish this but I am sure there is a more simple way to accomplish this with awk
.
cpu1_dimms=()
cpu2_dimms=()
missing=()
while read -r line; do
dimm=$(awk 'print $3' <<<"$line")
cpu=$dimm:1:1
size=$(awk 'print $5' <<<"$line")
if [[ -n "$size" ]]; then
case $cpu in
1) cpu1_dimms+=( "$dimm:3" );;
2) cpu2_dimms+=( "$dimm:3" );;
esac
fi
done < <(echo "$var")
for dimm in "$cpu1_dimms[@]"; do
if ! [[ "$cpu2_dimms[@]" =~ "$dimm" ]]; then
missing+=( "P2-$dimm" )
fi
done
for dimm in "$cpu2_dimms[@]"; do
if ! [[ "$cpu1_dimms[@]" =~ "$dimm" ]]; then
missing+=( "P1-$dimm" )
fi
done
This assumes that the output of the aforementioned command is stored in the variable var
bash text-processing awk
When a memory module in one of my servers fails the event log will often report the wrong DIMM slot or a non existent DIMM slot altogether. The best way we have come up with to determine the failed DIMM is by checking for which one is missing.
I have a command that produces the following output:
Location Tag: P1-DIMMA1 Size: 34359738368 bytes
Location Tag: P1-DIMMA2
Location Tag: P1-DIMMB1
Location Tag: P1-DIMMC1
Location Tag: P1-DIMMD1 Size: 34359738368 bytes
Location Tag: P1-DIMMD2
Location Tag: P1-DIMME1 Size: 34359738368 bytes
Location Tag: P1-DIMMF1
Location Tag: P2-DIMMA1 Size: 34359738368 bytes
Location Tag: P2-DIMMA2
Location Tag: P2-DIMMB1 Size: 34359738368 bytes
Location Tag: P2-DIMMC1
Location Tag: P2-DIMMD1 Size: 34359738368 bytes
Location Tag: P2-DIMMD2
Location Tag: P2-DIMME1 Size: 34359738368 bytes
Location Tag: P2-DIMMF1
In this example P1-DIMMB1 is failed (that DIMM slot is populated in P2 but not P1)
I am looking for a programmatic method to determine which DIMM slot(s) is/are empty in one cpu but not the other. I have come up with the following bash monstrocity to accomplish this but I am sure there is a more simple way to accomplish this with awk
.
cpu1_dimms=()
cpu2_dimms=()
missing=()
while read -r line; do
dimm=$(awk 'print $3' <<<"$line")
cpu=$dimm:1:1
size=$(awk 'print $5' <<<"$line")
if [[ -n "$size" ]]; then
case $cpu in
1) cpu1_dimms+=( "$dimm:3" );;
2) cpu2_dimms+=( "$dimm:3" );;
esac
fi
done < <(echo "$var")
for dimm in "$cpu1_dimms[@]"; do
if ! [[ "$cpu2_dimms[@]" =~ "$dimm" ]]; then
missing+=( "P2-$dimm" )
fi
done
for dimm in "$cpu2_dimms[@]"; do
if ! [[ "$cpu1_dimms[@]" =~ "$dimm" ]]; then
missing+=( "P1-$dimm" )
fi
done
This assumes that the output of the aforementioned command is stored in the variable var
bash text-processing awk
bash text-processing awk
asked yesterday
Jesse_bJesse_b
13.8k23471
13.8k23471
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
This AWK script finds missing DIMMs using the contents given on standard input or as a file to be processed:
!/Size:/
cpu = substr($3, 1, 2)
dimm = substr($3, 4)
missing[cpu] = missing[cpu] " " dimm
END
for (cpu in missing)
split(missing[cpu], dimms, " ")
for (key in dimms)
for (cmpcpu in missing)
if (cpu != cmpcpu && missing[cmpcpu] !~ dimms[key])
print cpu "-" dimms[key]
It outputs the missing DIMMs to its standard output.
The script works by listing lines with no “Size”, building up a string of missing DIMMs, per CPU. It then processes each CPU, splitting the string of missing DIMMs up, and looking for each individual DIMM in the other CPUs’ list of missing DIMMs; if it fails to match (for at least one other CPU), it outputs the DIMM as missing.
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%2f507751%2fdetermine-missing-dimm%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
This AWK script finds missing DIMMs using the contents given on standard input or as a file to be processed:
!/Size:/
cpu = substr($3, 1, 2)
dimm = substr($3, 4)
missing[cpu] = missing[cpu] " " dimm
END
for (cpu in missing)
split(missing[cpu], dimms, " ")
for (key in dimms)
for (cmpcpu in missing)
if (cpu != cmpcpu && missing[cmpcpu] !~ dimms[key])
print cpu "-" dimms[key]
It outputs the missing DIMMs to its standard output.
The script works by listing lines with no “Size”, building up a string of missing DIMMs, per CPU. It then processes each CPU, splitting the string of missing DIMMs up, and looking for each individual DIMM in the other CPUs’ list of missing DIMMs; if it fails to match (for at least one other CPU), it outputs the DIMM as missing.
add a comment |
This AWK script finds missing DIMMs using the contents given on standard input or as a file to be processed:
!/Size:/
cpu = substr($3, 1, 2)
dimm = substr($3, 4)
missing[cpu] = missing[cpu] " " dimm
END
for (cpu in missing)
split(missing[cpu], dimms, " ")
for (key in dimms)
for (cmpcpu in missing)
if (cpu != cmpcpu && missing[cmpcpu] !~ dimms[key])
print cpu "-" dimms[key]
It outputs the missing DIMMs to its standard output.
The script works by listing lines with no “Size”, building up a string of missing DIMMs, per CPU. It then processes each CPU, splitting the string of missing DIMMs up, and looking for each individual DIMM in the other CPUs’ list of missing DIMMs; if it fails to match (for at least one other CPU), it outputs the DIMM as missing.
add a comment |
This AWK script finds missing DIMMs using the contents given on standard input or as a file to be processed:
!/Size:/
cpu = substr($3, 1, 2)
dimm = substr($3, 4)
missing[cpu] = missing[cpu] " " dimm
END
for (cpu in missing)
split(missing[cpu], dimms, " ")
for (key in dimms)
for (cmpcpu in missing)
if (cpu != cmpcpu && missing[cmpcpu] !~ dimms[key])
print cpu "-" dimms[key]
It outputs the missing DIMMs to its standard output.
The script works by listing lines with no “Size”, building up a string of missing DIMMs, per CPU. It then processes each CPU, splitting the string of missing DIMMs up, and looking for each individual DIMM in the other CPUs’ list of missing DIMMs; if it fails to match (for at least one other CPU), it outputs the DIMM as missing.
This AWK script finds missing DIMMs using the contents given on standard input or as a file to be processed:
!/Size:/
cpu = substr($3, 1, 2)
dimm = substr($3, 4)
missing[cpu] = missing[cpu] " " dimm
END
for (cpu in missing)
split(missing[cpu], dimms, " ")
for (key in dimms)
for (cmpcpu in missing)
if (cpu != cmpcpu && missing[cmpcpu] !~ dimms[key])
print cpu "-" dimms[key]
It outputs the missing DIMMs to its standard output.
The script works by listing lines with no “Size”, building up a string of missing DIMMs, per CPU. It then processes each CPU, splitting the string of missing DIMMs up, and looking for each individual DIMM in the other CPUs’ list of missing DIMMs; if it fails to match (for at least one other CPU), it outputs the DIMM as missing.
answered yesterday
Stephen KittStephen Kitt
177k24402480
177k24402480
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%2f507751%2fdetermine-missing-dimm%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