• linux shell 实例1


    UI项目删除“UIL”文件中的无用字串:

    脚本需要制定UIL文件目录位置&无用字串的txt文件,如删除海尔目录下的无用字串:

    ./delete_uil_string.sh  ./haier/UI_Project/TV_UIProject_new/Languages  ./unused_stringId.txt
    #!/bin/bash
    
    #执行格式如:
    #./delete_uil_string.sh  ./haier/UI_Project/TV_UIProject_new/Languages ./unused_stringId.txt
    
    echo "Usage $0 languagesDir unused_stringId.txt"
    
    #提取需要迭代的目录
    uil_files=`ls $1`
    unused_strID=`cat $2`
    echo $uil_files
    echo "Processing..."
    for fb in $uil_files
    do
        for strID in $unused_strID
        do
            sed -i "/$strID/d" $1/$fb  #""代表单词结束or开始
        done
    done
    
    echo "Finish"

    对比Language Excel->txt输出无用字串列表“unused_str.txt”:

    #!/bin/bash
    
    #./delete_unused_string.sh   Language.txt   used_stringid.txt
    
    echo "Usage $0 excel_convert.txt used_stringid.txt"
    echo $1
    echo $2
    
    excel_list=`cut -f 1 $1`
    used_list=`cat $2`
    flag=0
    
    echo "Begin delete..."
    declare -i count=0
    echo > unused_str.txt
    for n in $excel_list
    do
        #echo $l
        used_list=`cat $2`
        for m in $used_list
        do
            #echo $m
            if [ "$m" = "$n" ]; then
                flag=1
                break
            fi
        done
    
        if [ $flag -eq 0 ]; then
            count=$count+1
            echo "$n" >> unused_str.txt
            echo "Not used $n"
            sed -i "/$n/d" $1
        else
            flag=0
        fi
    done
    echo "$count unused string"
    echo "Delete finished!"
    Language.txt如下:
    ID    Tchinese    Schinese    Spanish    French    German    Italian    Portuguese    Polish    Russian
    IDS_String_Delete_All    刪除全部    删除所有    Delete All    Delete All    Delete All    Delete All    Delete All    Delete All    Delete_All
    IDS_String_Time    時鐘    时钟    Hora    Heure    Zeit    Orario    Hora    Czas    Время
    IDS_String_TV    電視    视频输出    TV    TV    TV    TV    TV    TV    ТВ
    IDS_String_Version    版本    版本    Versión    Version    Version    Versione    Versão    Wersja    Версия
    IDS_String_Channel_Name    節目名稱    节目名称    Channel Name    Channel Name    Channel Name    Channel Name    Channel Name    Channel Name    Channel Name
    IDS_String_Pause    暫停    暂停    Pause    Pause    Pause    Pause    Pause    Pause    Pause
    IDS_String_Channel    頻道    频道    Canal    Canaux    Kanal    Canale    Canal    Kanał    канала
    IDS_String_Setting    設置    设置    Setting    Setting    Setting    Setting    Setting    Setting    Setting
    IDS_String_AV    AV    AV    AV    AV    AV    AV    AV    AV    AV
    IDS_String_Country    國家    国家    País    Pays    Land    Paese    País    Kraj    Страна
    IDS_String_Favorite_List    收藏夾    收藏夹    Favoritos    préférés    Favoriten    Elenco preferiti    Favoritos    Lista Ulubione    Список избранных
    IDS_String_1st_Preferred_Audio    第一首選音頻    第一首选音频    1st Audio    1st Audio    1st Audio    1st Audio    1st Audio    1st Audio    1st Audio
    IDS_String_Timers    定時器    定时器    Timers    Timers    Timers    Timers    Timers    Timers    Timers
    IDS_String_Channel_Number    節目號    节目号    Channel No.    Channel No.    Channel No.    Channel No.    Channel No.    Channel No.    Channel No.
    IDS_String_USB_Upgrade    USB升級    USB升级    USB Upgrade    USB Upgrade    USB Upgrade    USB Upgrade    USB Upgrade    USB Upgrade    USB Upgrade
    IDS_String_OTA_Upgrade    OTA升級    OTA升级    OTA Upgrade    OTA Upgrade    OTA Upgrade    OTA Upgrade    OTA Upgrade    OTA Upgrade    OTA Upgrade
    IDS_String_Date    日期    日期    Fecha    Date    Datum    Data    Data    Data    Дата
    IDS_String_Contrast    對比度    对比度    Contraste    Contraste    Kontrast    Contrasto    Contraste    Kontrast    Контраст
    IDS_String_Brightness    亮度    亮度    Brillo    Luminosité    Helligkeit    Luminosita    Brilho    Jasność    Яркость
    IDS_String_SPDIF    同軸    同轴    SPDIF    SPDIF    SPDIF    SPDIF    SPDIF    SPDIF    SPDIF
    used_stringid.txt如下:
    IDS_String_Good
    IDS_String_ExitScanInfo
    IDS_String_DTVbrace
    IDS_String_DTVATV
    IDS_String_ChannelInfo
    IDS_String_ModulationInfo
    IDS_String_ProgrammeTitle
    IDS_String_ScheduleSetup
    IDS_String_WrongPassword
    IDS_String_CADTVManualTuning
    IDS_String_QAMType
    IDS_String_WaitSearching
    IDS_String_PleaseSearching
    IDS_String_normal
    IDS_String_DefaultSource
    IDS_String_DefaultProg
    IDS_String_FirstTimeInstall
    IDS_String_AudioLanguage
    IDS_String_SubtitleLanguage
    IDS_String_PVRFileSystem
    IDS_String_HDMICEC
    IDS_String_DBEX_Success
    IDS_String_ErrNoUsbDev
    IDS_String_DBIM_Success
    IDS_String_PageUpPageDown
    IDS_String_SelectSort
    IDS_String_AutoVolumeLevel
  • 相关阅读:
    洛谷 P5595 【XR-4】歌唱比赛
    洛谷 P5594 【XR-4】模拟赛
    洛谷 AT1350 深さ優先探索
    洛谷 P1449 后缀表达式
    VIJOS-P1064 迎春舞会之数字舞蹈
    洛谷 P3998 [SHOI2013]发微博
    CF306C White, Black and White Again
    CF261E Maxim and Calculator
    JLOI 2014 松鼠的新家
    HNOI 2009 有趣的数列
  • 原文地址:https://www.cnblogs.com/jiangzhaowei/p/7725302.html
Copyright © 2020-2023  润新知