AWK其哈希值替换列 [英] Awk replace a column with its hash value

查看:785
本文介绍了AWK其哈希值替换列的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我怎么能与它的散列值(如MD5)在AWK或sed的?

How can I replace a column with its hash value (like MD5) in awk or sed?

原始文件是超级巨大的,所以我需要这是真正有效。

The original file is super huge, so I need this to be really efficient.

推荐答案

我复制粘贴larsks的反应,但我已经添加了近线,以避免在这个岗位指出的问题:<一href=\"http://stackoverflow.com/questions/2391272/gawk-awk-piping-date-to-getline-sometimes-wont-work\">gawk / AWK:管道日期函数getline * *有时会无法正常工作

I copy pasted larsks's response, but I have added the close line, to avoid the problem indicated in this post: gawk / awk: piping date to getline *sometimes* won't work

awk '{
    tmp="echo " $2 " | openssl md5 | cut -f2 -d\" \""
tmp | getline cksum
close(tmp)
$2=cksum
print
}' < sample 

这篇关于AWK其哈希值替换列的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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