#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Nov 2010
    Posts
    1
    Rep Power
    0

    Unhappy Sed: command garbled: s/


    Hello,

    I have to test a script which has been transfered from HP UX to Solaris 5.10 and i have the error below :

    sed: command garbled: s/


    The script is the following :

    cd /sigpsse/OutilsUnix/Z22


    echo `date +%d"/"%m"/"%Y" "%T`
    echo " "
    echo " les fichiers de log doivent etre dezippes "
    echo " ce traitement dure environ 1 mn ..."
    echo " "


    cat /sigpsse/OutilsUnix/Z22/TYBXSRB* | awk -F';' '{print NR";"$0}' | sed -e "s/^M//g" > tmp1

    cat tmp1 | sed -e "s/
    //g" | grep "INFORMATION : 90" | sed -e"s/ /@/g" > tmp2
    #rm tmp1

    > tmp3
    for enreg in `cat tmp2`
    do
    noligne=`echo $enreg | awk -F';' '{print $1}'`
    nomatricule=`expr $noligne - 2`
    noerreur=`expr $noligne + 23`
    echo $nomatricule >> tmp3
    echo $noerreur >> tmp3
    done
    rm tmp2

    > information90.txt
    for i in `cat tmp3`
    do
    cat tmp1 | grep "^$i;" | awk -F';' '{print $2}' >> information90.txt
    done
    rm tmp3
    rm tmp1

    mv information90.txt /sigpsse/OutilsUnix/Z22/bilans/`date +%Y"_"%m"_"%d"_"`information90.txt

    mv TYBXSRB* /sigpsse/OutilsUnix/Z22/archive/

    echo `date +%d"/"%m"/"%Y" "%T`

    exit



    Any idea why the sed command is not recognized ?


    Thanx a lot for your help
  2. #2
  3. Contributing User
    Devshed Novice (500 - 999 posts)

    Join Date
    Sep 2006
    Posts
    834
    Rep Power
    387

    Cool


    Originally Posted by freyr
    Hello,

    I have to test a script which has been transfered from HP UX to Solaris 5.10 and i have the error below :
    ... E t c ...
    cat tmp1 | sed -e "s/
    //g" | grep "INFORMATION : 90" | sed -e"s/ /@/g" > tmp2
    #rm tmp1
    sed: command garbled: s/
    ... E t c ...
    You cannot insert a carriage return (or line feed) within the search/replace of sed.

    If you need to remove the carriage return, try the "tr" command first:
    Code:
    cat tmp1 | tr -d '\n' | grep "INFORMATION : 90" | sed -e"s/ /@/g" > tmp2

IMN logo majestic logo threadwatch logo seochat tools logo