码迷,mamicode.com
首页 > 系统相关 > 详细

linux shell 实例

时间:2017-10-24 20:51:22      阅读:193      评论:0      收藏:0      [点我收藏+]

标签:min   install   adt   ubi   class   nal   back   echo   频道   

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 "/\b$strID\b/d" $1/$fb  #"\b"代表单词结束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 "/\b$n\b/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

 

linux shell 实例

标签:min   install   adt   ubi   class   nal   back   echo   频道   

原文地址:http://www.cnblogs.com/jiangzhaowei/p/7725302.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!