Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8500213
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T00:53:05+00:00 2026-06-11T00:53:05+00:00

I was searching for a means to format output from dmidecode a specific way,

  • 0

I was searching for a means to format output from dmidecode a specific way, and I found the following article which just about does what I need

http://www.experts-exchange.com/Programming/Languages/Scripting/Shell/Q_27770556.html

I modified some of the fields that I need from the code in the answer above, this shows awk creating csv output, with quotes, from dmidecode

dmidecode -t 17 | awk -F: '/Size|Locator|Speed|Manufacturer|Serial Number|Part Number/{sub(/^ */,"",$2);s=sprintf("%s,\"%s\"",s,$2)}/^Memory/{print s;s=""}END{print s}' |sed -e 's/,//' | grep -iv "no module" | tr -d ' '

"4096MB","CPU0","DIMM01","1066MHz","Samsung","754C2C33","M393B5273CH0-YH9"

I need tabbed, no quotes

4096MB  CPU0    DIMM01  1066MHz         Samsung         754C2C33        M393B5273CH0-YH9

I am still trying to get my head around awk and would appreciate anyone showing me the appropriate modifications

Fixed my code above, previously pasted non-working syntax

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-11T00:53:07+00:00Added an answer on June 11, 2026 at 12:53 am

    From the link you posted, I saved the data in a file called file.txt. I noticed that records are blank line separated. I used the following awk code:

    awk 'BEGIN { FS=":"; OFS="\t" } /Size|Locator|Speed|Manufacturer|Serial Number|Part Number/ { gsub(/^[ \t]+/,"",$2); line = (line ? line OFS : "") $2 } /^$/ { print line; line="" }' file.txt
    

    Results:

    2048 MB XMM1    Not Specified   1333 MHz    JEDEC ID    8106812F      HMT125U6BFR8C-H9
    No Module Installed XMM2    Not Specified   Unknown JEDEC ID        
    2048 MB XMM3    Not Specified   1333 MHz    JEDEC ID    7006C12F    HMT125U6BFR8C-H9
    No Module Installed XMM4    Not Specified   Unknown JEDEC ID        
    4096 kB SYSTEM ROM  Not Specified   Unknown Not Specified   Not Specified   Not Specified
    

    Your command line would now look like this:

    dmidecode -t 17 | awk 'BEGIN { FS=":"; OFS="\t" } /Size|Locator|Speed|Manufacturer|Serial Number|Part Number/ { gsub(/^[ \t]+/,"",$2); line = (line ? line OFS : "") $2 } /^$/ { print line; line="" }' | grep -iv "no module"
    

    EDIT:

    dmidecode -t 17 | awk 'BEGIN { FS=":"; OFS="\t" } /Size|Locator|Speed|Manufacturer|Serial Number|Part Number/ { if ($2 ~ /MB$|MHz$/) { gsub(/[ \t]+/,"",$2) } gsub(/^[ \t]+/,"",$2); line = (line ? line OFS : "") $2 } /^$/ { print line; line="" }' | grep -iv "no module"
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Searching online, I have found the following routine for calculating the sign of a
I want to do searching on encrypted data. Which means that there is the
I am searching for a way how I could select a div element which
Searching around I haven't found any recent answers to this question. The other answers
Searching here I found that this question was already asked , but I think
Searching from google.com, like www.abc.com Search Result Rank the pages like Title..... Description... www.abc.com
Searching a Python dictionary based on the value first, to get a key output
I'm building a rails app that takes information about products from an XML datafeed
does anybody know how to convert any kind of video format into flv using
The following Python snippet does exactly what I mean: def function(a, b, c): print(%i

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.