sed problem with scripting

Posted by Pablo Ramos on Ask Ubuntu See other posts from Ask Ubuntu or by Pablo Ramos
Published on 2013-11-05T15:35:40Z Indexed on 2013/11/05 16:12 UTC
Read the original article Hit count: 339

Filed under:
|

I am trying to run a script using sed i runing like this

for et in   1 # 2 3
    do

      if [ -d ET$et ]; then rm -rf ET$et; fi

        mkdir ET$et
        cd ET$et
        cp  $home/step_$i/FDE/diabatA/run.adf .
        cp  $home/step_$i/FDE/diabatA/mas$i.xyz .

        awk1=`awk '/type=fde/{print NR }' run.adf | head -1`
        awk2=`$(echo "$a+379" | bc -l )`
       sed -n "$awk1,"$awk2"p" run.adf > first

        awk3=`awk '/ATOMS/{print NR +1}' first`
        awk4=`cat mas$i.xyz | wc -l`
        awk4=$( echo "$awk4-1" | bc -l )
        awk5=`awk "/ATOMS/{print NR +"${awk4}" }" run.adf`
        sed -n "$awk3,"$awk4"p" first > atoms

        par=$( echo "$awk4-99" | bc -l )
        rho1=$(cat atoms | head -34 )
        rho2=$(cat atoms | head -64 | tail -31)
        rho3=$(cat atoms | head -97 | tail -33)
        rhoall=$(cat atoms | tail -${par} )

        echo -e "$rho1\n$rho2\n$rhoall" > eje
done

but is telling me this:

(standard_in) 1: syntax error
sed: -e expression #1, char 6: unexpected `,'
sed: -e expression #1, char 1: unknown command: `,'

Please, I appreciate any help with this issue...

Thanks Pablo

© Ask Ubuntu or respective owner

Related posts about shell-scripting

Related posts about sed