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










1















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










share|improve this question


























    1















    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










    share|improve this question
























      1












      1








      1








      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










      share|improve this question














      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






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked yesterday









      Jesse_bJesse_b

      13.8k23471




      13.8k23471




















          1 Answer
          1






          active

          oldest

          votes


















          2














          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.






          share|improve this answer






















            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
            );



            );













            draft saved

            draft discarded


















            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









            2














            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.






            share|improve this answer



























              2














              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.






              share|improve this answer

























                2












                2








                2







                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.






                share|improve this answer













                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.







                share|improve this answer












                share|improve this answer



                share|improve this answer










                answered yesterday









                Stephen KittStephen Kitt

                177k24402480




                177k24402480



























                    draft saved

                    draft discarded
















































                    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.




                    draft saved


                    draft discarded














                    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





















































                    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







                    Popular posts from this blog

                    getting Checkpoint VPN SSL Network Extender working in the command lineHow to connect to CheckPoint VPN on Ubuntu 18.04LTS?Will the Linux ( red-hat ) Open VPNC Client connect to checkpoint or nortel VPN gateways?VPN client for linux machine + support checkpoint gatewayVPN SSL Network Extender in FirefoxLinux Checkpoint SNX tool configuration issuesCheck Point - Connect under Linux - snx + OTPSNX VPN Ububuntu 18.XXUsing Checkpoint VPN SSL Network Extender CLI with certificateVPN with network manager (nm-applet) is not workingWill the Linux ( red-hat ) Open VPNC Client connect to checkpoint or nortel VPN gateways?VPN client for linux machine + support checkpoint gatewayImport VPN config files to NetworkManager from command lineTrouble connecting to VPN using network-manager, while command line worksStart a VPN connection with PPTP protocol on command linestarting a docker service daemon breaks the vpn networkCan't connect to vpn with Network-managerVPN SSL Network Extender in FirefoxUsing Checkpoint VPN SSL Network Extender CLI with certificate

                    Cannot Extend partition with GParted The 2019 Stack Overflow Developer Survey Results Are In Announcing the arrival of Valued Associate #679: Cesar Manara Planned maintenance scheduled April 17/18, 2019 at 00:00UTC (8:00pm US/Eastern) 2019 Community Moderator Election ResultsCan't increase partition size with GParted?GParted doesn't recognize the unallocated space after my current partitionWhat is the best way to add unallocated space located before to Ubuntu 12.04 partition with GParted live?I can't figure out how to extend my Arch home partition into free spaceGparted Linux Mint 18.1 issueTrying to extend but swap partition is showing as Unknown in Gparted, shows proper from fdiskRearrange partitions in gparted to extend a partitionUnable to extend partition even though unallocated space is next to it using GPartedAllocate free space to root partitiongparted: how to merge unallocated space with a partition

                    Marilyn Monroe Ny fiainany manokana | Jereo koa | Meny fitetezanafanitarana azy.