AIX

AIX

Connect with fellow AIX users and experts to gain knowledge, share insights, and solve problems.


#Power
#Power
 View Only
  • 1.  sed command not working in AIX 5.3

    Posted Fri August 27, 2010 02:48 AM

    Originally posted by: gerard-mzs


    Hello experts,

    Im trying to execute the following lines of script in AIX 5.3,
    but the sed command seems to fail as I cant see any output and
    the $responseXmlFile that gets created is 0 bytes

    # Add new lines
    sed -e 's/\(<\/\w*:\w*\>\)./\1>\n/g' "$tempResponseXmlFile" > "$responseXmlFile"

    if $? -ne 0 ; then
    warn "sed reported an error."
    fi

    # Create local variables
    local queueName_arr_tmp=`sed -n -e 's/.<\w:queueName>\(.\)<\/\w:queueName>.*/\1/p' "$responseXmlFile"`
    local queueStatus_arr_tmp=`sed -n -e 's/.<\w:queueStatus>\(.\)<\/\w:queueStatus>.*/\1/p' "$responseXmlFile"`

    This script was originally written for Linux. When I tried to run it on HP-UX I faced the same problem.
    So I installed the GNU sed on HP-UX and it worked fine. I did the same (installed GNU sed) on AIX,
    but it hasnt resolved the problem.

    The $tempResponseXmlFile is attached to this thread to your ref.

    Any ideas on how to get these sed script lines to work on AIX 5.3 ?
    Thanks
    Gerard
    #AIX-Forum


  • 2.  Re: sed command not working in AIX 5.3

    Posted Fri August 27, 2010 04:20 AM

    Originally posted by: gerard-mzs


    Attaching a pair of $responseXmlFile and $tempResponseXmlFile
    generated from a working system on Linux.
    So you can see the difference in content.
    It's basically adding "\n" to specific parts of the string.
    #AIX-Forum


  • 3.  Re: sed command not working in AIX 5.3

    Posted Mon August 30, 2010 09:30 PM

    Originally posted by: SystemAdmin


    Hi Gerard,

    I assume you have modified your PATH so that the gnu sed is found before the IBM version?

    The reason I looked up your message is that I have a failing sed command in a "make" of open source software. In this situation I was able to workaround the failure by deleting it from the make file, running the sed manually from the command line, then rerunning make; but this won't help you.

    Good luck,
    George
    #AIX-Forum


  • 4.  Re: sed command not working in AIX 5.3

    Posted Mon August 30, 2010 09:44 PM

    Originally posted by: GerardM


    Hi George,

    Thanks for your inputs.
    Im a novice in UNIX scripting, so you are right,
    even though I had the GNU sed executable in my scripts directory,
    it was picking up the IBM version of it.
    So I changed my script file to prefix "." to the system $PATH.

    Thanks
    -Gerard
    #AIX-Forum