Skip to content

Instantly share code, notes, and snippets.

@usaturn
Created February 18, 2015 07:35
Show Gist options
  • Save usaturn/9b18c7ed2b223caba402 to your computer and use it in GitHub Desktop.
Save usaturn/9b18c7ed2b223caba402 to your computer and use it in GitHub Desktop.
#CPU Affinityの設定する時に確認用の表を出力したいんだけど誰かawkだけでまとめて!
awk 'BEGIN{FS=":"} /(processor|physical id|core id)/{print $1,$2}' /proc/cpuinfo | perl -pe 's/(processor|physical)[^\d]+(\d{1,})\n/\1\t\2\t/g'
@togakushi
Copy link

こうですかワカリマセン><
awk -F':' '{if(/processor/){printf "processor\t%d\t",$2}if(/physical id/){printf "physical id\t%d\t",$2}if(/core id/){printf "core id\t%d\n",$2}}' /proc/cpuinfo

@togakushi
Copy link

awk -F':' '/processor/{printf "%s\t%d\t",$1,$2}/physical id/{printf "%s\t%d\t",$1,$2}/core id/{printf "%s\t%d\n",$1,$2}' /proc/cpuinfo

@usaturn
Copy link
Author

usaturn commented Mar 12, 2016

完全にスルーしてた

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment