awk - 使用 awk 限制透明大页面的输出
问题描述
我将如何awk
过滤透明大页面的当前设置?
透明大页面的示例输出:
$ cat /sys/kernel/mm/transparent_hugepage/enabled
always madvise [never]
我只想输出当前设置:
never
解决方案
以下awk
也可能对您有所帮助。
awk -F"[][]" 'NF{print $2}' Input_file
说明:以下不是确切的代码,仅用于说明目的。
-F"[][]" ##Setting field separator as ] and [ for each line in Input_file.
'NF{ ##Checking condition here if line is NOT NULL where NF is number of fields awk variable which will be set only when a line is NOT NULL.
print $2} ##If above condition is TRUE then print the 2nd field of current line of Input_file.
' Input_file ##Mentioning Input_file name here.
推荐阅读
- node.js - 如何将项目引用与不同的 tsconfig 文件一起使用?
- java - java.net.UnknownHostException:java.base/java.net.Inet6AddressImpl.lookupAllHostAddr(本机方法)
- node.js - 上传 Cloudinary 后如何裁剪图像?
- angular - Angular 10 - 在订阅中调度 NGXS 动作导致无限循环
- r - 如何使用 Get_Labels 在 R 中正确标记图表上的条形?
- typescript - Using private properties with Module Augmentation in Typescript
- ios - 在 iOS (Flutter) 上调用 Agora RTC SDK 时如何获取麦克风输入流?
- docker - 从 pod 访问 CIFS 文件
- passport.js - 如何解决护照 saml 策略的问题
- express - 在 Nodejs 中使用 Multer 上传图像时出错