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
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 followingawkcode:Results:
Your command line would now look like this:
EDIT: