如何在 unix 上取消特定月份的打印作业,例如
sudo cancel -e printernames month
这是我要处理的打印队列文本
EpsonP_URSB-4125 admingou priority 0 Aug 9 14:49 on EpsonP_URSB
o24683889.out 3897 bytes
EpsonP_URSB-4126 admingou priority 0 Aug 9 14:51
o24683917.out 3897 bytes
EpsonP_URSB-4168 admingou priority 0 Aug 9 16:40
o24685868.out 3873 bytes
EpsonP_URSB-4169 admingou priority 0 Aug 9 16:49
o24686042.out 3873 bytes
EpsonP_URSB-4594 admingou priority 0 Aug 15 14:02
o24728095.out 3873 bytes
EpsonP_URSB-4795 admingou priority 0 Aug 16 15:32
o24739409.out 3942 bytes
EpsonP_URSB-6877 admingou priority 0 Sep 2 08:11
o24866057.out 3909 bytes
EpsonP_URSB-9143 admingou priority 0 Sep 19 08:36
o25011121.out 3873 bytes
EpsonP_URSB-9144 admingou priority 0 Sep 19 08:40
o25011183.out 3899 bytes
EpsonP_URSB-9146 admingou priority 0 Sep 19 08:44
o25011237.out 3922 bytes
EpsonP_URSB-9153 admingou priority 0 Sep 19 08:57
o25011532.out 3873 bytes
EpsonP_URSB-9154 admingou priority 0 Sep 19 08:58
o25011538.out 4118 bytes
EpsonP_URSB-9155 admingou priority 0 Sep 19 08:58
o25011542.out 3893 bytes
EpsonP_URSB-9158 admingou priority 0 Sep 19 09:19
o25011789.out 3967 bytes
EpsonP_URSB-9159 admingou priority 0 Sep 19 09:22
o25011836.out 3967 bytes
EpsonP_URSB-9160 admingou priority 0 Sep 19 09:23
o25011907.out 4060 bytes
EpsonP_URSB-9161 admingou priority 0 Sep 19 09:24
o25011930.out 4015 bytes
考虑一下打印机队列中的这样一行:
要匹配第五个字段,并从第一个字段中取消作业 ID:
您可能需要调整
cancel
命令以包含打印机队列。-r
如果您的版本xargs
不支持,请删除。如果您必须为每个作业分别-n1
发出命令,请添加。当您对输出感到满意时cancel
删除。echo