有文件list.txt 我想取出开头不含 building ,sent ,total 的所有行,怎么办呀

caixicn 2007-11-08 06:35:44
有文件list.txt 我想取出开头不含 building ,sent ,total 的所有行,怎么办呀,我用正则试了很久,好像linux下的正则不一样??。。

我的做法,不过不行.
egrep "^(^(total |creating |sent |building ).*)$" list.txt 


list.txt

building file list ... done
./
hlo/
hfsdkfsd/
fsd/fasdf/safd/
hellopig.gif
fdsaf/fsdf/
sdfsdi.com
sent 700020 bytes received 48 bytes 466712.00 bytes/sec
total size is 1586521359 speedup is 2266.24

...全文
58 2 打赏 收藏 转发到动态 举报
写回复
用AI写文章
2 条回复
切换为时间正序
请发表友善的回复…
发表回复
yvqq 2007-11-16
  • 打赏
  • 举报
回复
egrep "total|building|send " -v list.txt
caixicn 2007-11-08
  • 打赏
  • 举报
回复
现在用了个土方法

awk '{ if (($0~/^.*\/$/)||($0~/^sent .*$/)||($0~/^total .*$/)||($0~/^building .*$/)||($0~/^creating .*$/)) {} else{print $0} }' list.txt

19,612

社区成员

发帖
与我相关
我的任务
社区描述
系统使用、管理、维护问题。可以是Ubuntu, Fedora, Unix等等
社区管理员
  • 系统维护与使用区社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧