【问题标题】:sendmail mailq sort by year regular expression, updated naming conventionsendmail mailq 按年份正则表达式排序,更新命名约定
【发布时间】:2021-07-13 21:07:12
【问题描述】:

this suggestion 上跟进mailq sort,在我们的例子中,我们想在排序中添加年份,因为这是一个隔离区。您将如何在第一列中包含第一个字符,即年份? 001CJwkY1702541 的第一个 0 是 2020。

mailq -qQ|grep "^[A-F0-9]" | sort -k8n -k4M -k5n -k6n
001CJwkY1702541 5623 Wed Jan  1 07:19 <user@ourdomain.edu>

同样来自sendmail 8.11 文档,第 79 页:

All queue files have the name x fYMDhmsNPPPPP where YMDhmsNPPPPP is the id for this message and the x is a type. The individual letters in the id are:
Y Encoded year
M Encoded month
D Encoded day
h Encoded hour
m Encoded minute
s Encoded second
N Envelope number
PPPPP At least five digits of the process ID

这似乎很旧,因为001CJwkY1702541 不对应于fYMDhmsNPPPPP。是否有更新的文件显示这一点?第一个数字“0”是年份,第二个数字也是“0”,似乎是一月,第三个数字“1”是月份中的日期。但这并不总是有意义的,例如,使用另一个隔离队列 ID,例如 00ACF2XJ4027295

【问题讨论】:

    标签: regex sendmail mail-queue


    【解决方案1】:

    我的同事想出了这个。要按初始数字而不是该字符串的其余部分进行排序,您需要将其与其余部分分开。这将重新编号 剩余字段。

    mailq -qQ | sed -e 's/^\(.\)/\1 /' | grep "^[A-F0-9]" | sort -k1n -k5M -k6n -k7n|less
    

    这使它按递增顺序排列。我会看看我是否可以让最新的成为第一个并在此处进行相应的更新,但这基本上回答了我的问题。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-01-30
      • 2019-01-31
      • 2020-05-05
      • 2011-02-08
      • 1970-01-01
      相关资源
      最近更新 更多