当前位置: 技术问答>linux和unix
bash script /proc/partitions取字串問題
来源: 互联网 发布时间:2016-11-06
本文导语: cat /proc/partitions major minor #blocks name 3 0 160086528 hda 3 1 10482381 hda1 3 2 10482412 hda2 3 3 10482412 hda3 3 4 128632455 hda4 3 64 312571224 hdb ...
cat /proc/partitions
major minor #blocks name
3 0 160086528 hda
3 1 10482381 hda1
3 2 10482412 hda2
3 3 10482412 hda3
3 4 128632455 hda4
3 64 312571224 hdb
3 65 312568641 hdb1
如果要取出hda2的blocks ,10482412 該怎樣下指令呢
cat /proc/partitions|grep hda2|???
major minor #blocks name
3 0 160086528 hda
3 1 10482381 hda1
3 2 10482412 hda2
3 3 10482412 hda3
3 4 128632455 hda4
3 64 312571224 hdb
3 65 312568641 hdb1
如果要取出hda2的blocks ,10482412 該怎樣下指令呢
cat /proc/partitions|grep hda2|???
|
awk '/hda2/ {print $3}' /proc/partitions
|
cat /proc/partitions|grep hda2| tr -s " " | cut -d" " -f4
|
awk 'if($NR=3) {print $4 }' /proc/partitions
本站(WWW.)旨在分享和传播互联网科技相关的资讯和技术,将尽最大努力为读者提供更好的信息聚合和浏览方式。
本站(WWW.)站内文章除注明原创外,均为转载、整理或搜集自网络。欢迎任何形式的转载,转载请注明出处。
本站(WWW.)站内文章除注明原创外,均为转载、整理或搜集自网络。欢迎任何形式的转载,转载请注明出处。