Insert/replace 哈希值:"Hexadecimal string contains non-hex character"

Insert/replace hash value: "Hexadecimal string contains non-hex character"

我得到了一个 MySQL 数据库的转储,我想以 MySQL 模式将它加载到 H2 中。到目前为止,它运行良好,除了 "users" table,其中包含散列密码并给出此错误:

'Hexadecimal string contains non-hex character: "UQ�m������l�a_x"; 
SQL statement:INSERT INTO `users` VALUES (2,16,'him','UQ�m������l�a_x', ...);

由于它们在这种情况下没有用,我可以用任何其他文本值替换这些十六进制字符串。例如,我可以用 sed 做到这一点吗?

我试过这个:sed -e "s/'[\d128-\d255]'//g 但它替换了我文件的 95%。

我看过准备 JDBC 语句的答案,但我没有动手(这些是 Play 框架自动应用的 "evolutions")。

要删除非 ascii 文本,您可以使用 trsed,这是一个使用 tr 的基本示例:

 echo -e "\xA9 "This is acsii text" \xA7 \xA3 \xA1 \xA2"
© This is acsii text § £ ¡ ¢

未删除 ascii 字符:使用 tr -c -d '[[:alnum:]]|[[:space:]]|[:punct:]]'

echo -e "\xA9 "This is acsii text" \xA7 \xA3 \xA1 \xA2"   |tr -c -d '[[:alnum:]]|[[:space:]]|[[:punct:]]'
 This is acsii text 

echo -e "\xA9 "This is acsii text" \xA7 \xA3 \xA1 \xA2"   |tr -cd '[=12=]0-7'
 This is acsii text

使用其他答案,我设法让它在 sed 中工作(增加了替换的可能性),如下所示:

sed -E -e "s/[^[:alnum:][:space:][:punct:]]//g"