Ubuntu
根據給定的每小時間隔範圍從郵件列表生成文本文件
這是一系列電子郵件文件,輸出自
$ ls --time-style=long-iso -la
:23:12 1570840157.M399816P376041.br472.hostgator.com.br,S=300488,W=304621:2, 23:41 1570840228.M85932P379995.br472.hostgator.com.br,S=307582,W=311813:2, 00:31 1570840312.M211863P379995.br472.hostgator.com.br,S=301166,W=305309:2, 01:32 1570840376.M535629P379995.br472.hostgator.com.br,S=308153,W=312391:2, 02:34 1570840441.M68421P382468.br472.hostgator.com.br,S=307387,W=311615:2, 02:35 1570840530.M391347P385138.br472.hostgator.com.br,S=298927,W=303039:2, 04:06 1570840597.M688174P387663.br472.hostgator.com.br,S=302107,W=306263:2, 04:08 1570840657.M991954P387663.br472.hostgator.com.br,S=299284,W=303401:2, 04:09 1570840743.M587693P390982.br472.hostgator.com.br,S=299941,W=304067:2, 06:40 1570840805.M471644P390982.br472.hostgator.com.br,S=305586,W=309789:2, 06:44 1570840869.M734632P390982.br472.hostgator.com.br,S=302585,W=306747:2, 07:20 1570840929.M49892P396393.br472.hostgator.com.br,S=300967,W=305107:2, 08:10 1570840996.M935135P396393.br472.hostgator.com.br,S=309171,W=313423:2,
我們需要一個文本文件,其文件名的時間戳從 00:00 到 06:59。
知道怎麼做嗎?
awk -F':' '($1+0<7){ print }' file
用作輸入欄位分隔符,通過
:
添加零 ($1+0
) 將第一個欄位轉換為數字,如果值為 ,則列印該行<7
。
如果我理解正確,這對您有幫助嗎?
grep "^0[0-6]:[0-5][0-9]" file > new_file