gpt4 book ai didi

linux - 在 linux 邮件服务器上查找邮件消息

转载 作者:太空宇宙 更新时间:2023-11-04 12:08:27 26 4
gpt4 key购买 nike

我尝试在其中查找特定字符串的消息,然后删除该文件。这是我的脚本。我做错了什么?

#!/bin/bash
NAME="СЛОВО"
NAME_KOI=`echo "$NAME" | enca -L ru -x koi8-r`
echo $NAME_KOI
NAME_CP1251=`echo "$NAME" | enca -L ru -x CP1251`
echo $NAME_CP1251
NAME_ISO=`echo "$NAME" | enca -L ru -x ISO-8859-5`
echo $NAME_ISO
NAME_IBM=`echo "$NAME" | enca -L ru -x IBM866`
echo $NAME_IBM

for i in `find -type f` ; do grep -i -e "$NAME_KOI" -e "$NAME_CP1251" -e "$NAME_ISO" -e "$NAME_IBM" $i ; done

最佳答案

所以我自己写脚本

#!/bin/bash
NAME="слово"
NAME_1LOWER="$NAME"
NAME_1UPPER=`echo "$NAME" | sed 's/.*/\u&/'`
echo "NAME_1LOWER:$NAME_1LOWER"

#koi8-r
NAME_1UPPER_KOI=`echo "$NAME_1UPPER" | enca -L ru -x koi8-r`
NAME_1UPPER_QUOT_KOI=`echo "$NAME_1UPPER" | enca -L ru -x koi8-r | qprint -e`
NAME_1UPPER_BASE64_KOI=`echo -n "$NAME_1UPPER" |enca -L ru -x koi8-r | base64 | sed 's/.\{5\}$//'`

#echo "NAME_1UPPER_KOI:$NAME_1UPPER_KOI"
#echo "NAME_1UPPER_QUOT_KOI:$NAME_1UPPER_QUOT_KOI"

NAME_1LOWER_KOI=`echo "$NAME_1LOWER" | enca -L ru -x koi8-r`
NAME_1LOWER_QUOT_KOI=`echo "$NAME_1LOWER" | enca -L ru -x koi8-r | qprint -e`
NAME_1LOWER_BASE64_KOI=`echo -n "$NAME_1LOWER" |enca -L ru -x koi8-r | base64 | sed 's/.\{5\}$//'`

#echo "$NAME_1LOWER_KOI"
#echo "$NAME_1LOWER_QUOT_KOI"

#CP1251
NAME_1UPPER_CP1251=`echo "$NAME_1UPPER" | enca -L ru -x CP1251`
NAME_1UPPER_QUOT_CP1251=`echo "$NAME_1UPPER" | enca -L ru -x CP1251 | qprint -e`
NAME_1UPPER_BASE64_CP1251=`echo -n "$NAME_1UPPER" |enca -L ru -x CP1251 | base64 | sed 's/.\{5\}$//'`

NAME_1LOWER_CP1251=`echo "$NAME_1LOWER" | enca -L ru -x CP1251`
NAME_1LOWER_QUOT_CP1251=`echo "$NAME_1LOWER" | enca -L ru -x CP1251 | qprint -e`
NAME_1LOWER_BASE64_CP1251=`echo -n "$NAME_1LOWER" |enca -L ru -x CP1251 | base64 | sed 's/.\{5\}$//'`

#ISO-8859-5
NAME_1UPPER_ISO=`echo "$NAME_1UPPER" | enca -L ru -x ISO-8859-5 `
NAME_1UPPER_QUOT_ISO=`echo "$NAME_1UPPER" | enca -L ru -x ISO-8859-5 | qprint -e`
NAME_1UPPER_BASE64_ISO=`echo -n "$NAME_1UPPER" |enca -L ru -x ISO-8859-5 | base64 | sed 's/.\{5\}$//'`

NAME_1LOWER_ISO=`echo "$NAME_1LOWER" | enca -L ru -x ISO-8859-5`
NAME_1LOWER_QUOT_ISO=`echo "$NAME_1LOWER" | enca -L ru -x ISO-8859-5 | qprint -e`
NAME_1LOWER_BASE64_ISO=`echo -n "$NAME_1LOWER" |enca -L ru -x ISO-8859-5 | base64 | sed 's/.\{5\}$//'`

#IBM866
NAME_1UPPER_IBM=`echo "$NAME_1UPPER" | enca -L ru -x IBM866`
NAME_1UPPER_QUOT_IBM=`echo "$NAME_1UPPER" | enca -L ru -x IBM866 | qprint -e`
NAME_1UPPER_BASE64_IBM=`echo -n "$NAME_1UPPER" |enca -L ru -x IBM866 | base64 | sed 's/.\{5\}$//'`

NAME_1LOWER_IBM=`echo "$NAME_1LOWER" | enca -L ru -x IBM866`
NAME_1LOWER_QUOT_IBM=`echo "$NAME_1LOWER" | enca -L ru -x IBM866 | qprint -e`
NAME_1LOWER_BASE64_IBM=`echo -n "$NAME_1LOWER" |enca -L ru -x IBM866 | base64 | sed 's/.\{5\}$//'`

#for i in `find -type f` ; do
grep -r \
-e "$NAME_1UPPER_KOI" -e "$NAME_1UPPER_QUOT_KOI" -e "$NAME_1LOWER_KOI" -e "$NAME_1LOWER_QUOT_KOI" -e "$NAME_1LOWER_BASE64_KOI" \
-e "$NAME_1UPPER_CP1251" -e "$NAME_1UPPER_QUOT_CP1251" -e "$NAME_1LOWER_CP1251" -e "$NAME_1LOWER_QUOT_CP1251" -e "$NAME_1LOWER_BASE64_CP1251" \
-e "$NAME_1UPPER_ISO" -e "$NAME_1UPPER_QUOT_ISO" -e "$NAME_1LOWER_ISO" -e "$NAME_1LOWER_QUOT_ISO" -e "$NAME_1LOWER_BASE64_ISO" \
-e "$NAME_1UPPER_IBM" -e "$NAME_1UPPER_QUOT_IBM" -e "$NAME_1LOWER_IBM" -e "$NAME_1LOWER_QUOT_IBM" -e "$NAME_1LOWER_BASE64_IBM" \
./ | enca -L ru -x UTF-8
# $i ; done

关于linux - 在 linux 邮件服务器上查找邮件消息,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49793319/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com