我想将自己的标题添加到此命令的打印输出中并保存到文件中:
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