Shell Code Example

#!/bin/sh

wxw="0.0"
echo $wxw


while read line
do
    vl=`echo $line | cut -d" " -f12`
#    echo $vl
#    echo $line | cut -d" " -f12
    if [ "$vl" = "$wxw" ]; then
#        echo $line | cut -d' ' -f12
        echo $line | cut -d' ' -f2    
    fi
    
done < build_profile.prf


#--#!/bin/bash

# while read line
#do
#    if test "${line:96:3}" == "0.0"; then
#        echo ${line:96:3}
#    elif test "${line:96:4}" == " 0.0"; then
#        echo ${line:96:4}
#    fi
#done < build_profile.prf
























#!/bin/sh

templataOneCode=""
templateOneChain=""
templataTwoCode=""
templateTwoChain=""

# translate workPath + '/temp/build_profile.prf' File
count=0
while read line
do
    vl=`echo $line | cut -d" " -f12`
    if [ "$vl" = "0.0" ]; then
        CodeChain=`echo $line | cut -d' ' -f2`
        echo $CodeChain
        if [ "$count" -eq "2" ]; then
            if [ "${#CodeChain}" -eq "5" ]; then
                templataTwoCode=`echo $CodeChain | cut -c-4`
                templateTwoChain=`echo $CodeChain | cut -c5-`
                break
            fi
        fi
        if [ "$count" -eq "1" ]; then
            if [ "${#CodeChain}" -eq "5" ]; then
                templataOneCode=`echo $CodeChain | cut -c-4`
                templateOneChain=`echo $CodeChain | cut -c5-`
                count=2
            fi
        fi    
        if [ "$count" -eq "0" ]; then
            count=1        
        fi
    fi
done < ./temp/build_profile.prf

echo $templataOneCode
echo $templateOneChain
echo $templataTwoCode
echo $templateTwoChain

你可能感兴趣的:(Shell Code Example)