使用grep匹配md5哈希 [英] Using grep to match md5 hashes

查看:199
本文介绍了使用grep匹配md5哈希的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何使用grep命令匹配md5哈希?

How can I match md5 hashes with the grep command?

在php中,我过去使用过这种正则表达式模式:

In php I used this regular expression pattern in the past:

/^[0-9a-f]{32}$/i

但是我尝试过:

grep '/^[0-9a-f]{32}$/i' filename
grep '[0-9a-f]{32}$/' filename
grep '[0-9a-f]{32}' filename

和其他变体,但我没有得到任何输出,而且我确定该文件包含md5哈希.

And other variants, but I am not getting anything as output, and i know for sure the file contains md5 hashes.

推荐答案

您要这样做:

grep -e "[0-9a-f]\{32\}" filename

或更像,根据您的文件格式描述,

Or more like, based on your file format description, this:

grep -e ":[0-9a-f]\{32\}" filename

这篇关于使用grep匹配md5哈希的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆