![Top -p 结果放入文件](https://linux22.com/image/1090280/Top%20-p%20%E7%BB%93%E6%9E%9C%E6%94%BE%E5%85%A5%E6%96%87%E4%BB%B6.png)
我想将自己的标题添加到此命令的打印输出中并保存到文件中:
top -p 1198172,1198173,1198174.1198175,1198176,1198177,1198178 | awk '{print $1,"---",$9,"---",$10,"---",$12}'
答案1
我想这就是你想要的:
(echo "Headers are fun";top -p 1198172,1198173,1198174,1198175,1198176,1198177,1198178 | awk '{print $1,"---",$9,"---",$10,"---",$12}') >file